PageRenderTime 14ms CodeModel.GetById 8ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Examples/test-suite/abstract_typedef2.i

#
Swig | 60 lines | 39 code | 17 blank | 4 comment | 0 complexity | 3b3fb938af3d9f14c6f76607a55c5492 MD5 | raw file
 1%module abstract_typedef2
 2
 3 /*
 4   After the fix for abstract_typedef, this simpler
 5   example got broken.
 6 */
 7
 8%inline %{
 9
10  enum FieldDim {
11    UnaryField,
12    BinaryField
13  };
14  
15  template <FieldDim Dim>
16    struct Facet;
17  
18
19  template <FieldDim Dim>
20    struct Base 
21    {
22      virtual ~Base() {}
23      
24      typedef unsigned int size_type;
25      typedef Facet<Dim>* facet_ptr;
26
27      // This works 
28      // virtual Facet<Dim>* set(size_type) = 0;
29      
30      // This doesn't
31      virtual facet_ptr set(size_type) = 0;
32    };
33  
34
35  template <FieldDim Dim>
36    struct Facet
37    {
38    };
39  
40
41  template <FieldDim Dim>
42    struct A : Base<Dim>
43    {
44      typedef Base<Dim> base;
45      typedef typename base::size_type size_type;
46
47      A(int a = 0)
48      {
49      }
50      
51      Facet<Dim>* set(size_type) 
52      {
53	return 0;
54      }      
55    };
56%}
57
58
59%template(Base_UF) Base<UnaryField>;
60%template(A_UF) A<UnaryField>;