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

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

#
Swig | 37 lines | 26 code | 11 blank | 0 comment | 0 complexity | 9cb76bf5bdcc74ef110cce9447e02ea1 MD5 | raw file
 1%module template_specialization
 2
 3%rename(not1) *::operator!() const;
 4%rename(negate) *::operator-() const;
 5
 6%inline %{
 7  
 8  namespace vfncs {
 9    
10    template <class ArgType>
11    struct UnaryFunction 
12    {
13      UnaryFunction operator-() const { return *this; }
14    };
15
16    template <>
17    struct UnaryFunction<bool>
18    {
19      // This works
20      // UnaryFunction<bool> operator!() const;
21
22      // This doesn't
23      UnaryFunction operator!() const { return *this; }
24
25      // Does this?
26      void foo(UnaryFunction) { }
27      
28    };
29    
30  }
31%}
32
33namespace vfncs {  
34
35  %template(UnaryFunction_double) UnaryFunction<double>;  
36  %template(UnaryFunction_bool) UnaryFunction<bool>;  
37}