DGtal  1.5.beta
testPartialTemplateSpecialization.cpp
Go to the documentation of this file.
1 
31 #include <iostream>
33 #include <boost/type_traits/is_arithmetic.hpp>
34 #include <boost/type_traits/is_integral.hpp>
35 #include <boost/utility/enable_if.hpp>
36 #include "DGtal/base/Common.h"
37 
39 // Functions for testing class cpp11.
41 
42 template< typename TC, typename TD >
43 class A
44 {
45 public:
46  typedef TC C;
47 
48  A( const C& c );
49 };
50 
51 template< typename TC, typename TD >
52 inline
53 A< TC, TD >::A( const C& c )
54 {
55  boost::ignore_unused_variable_warning( c );
56  std::cout << "Generic" << std::endl;
57 }
58 
59 
60 
61 template< typename TC > //int specialization
62 class B : public A< TC, int >
63 {
64 public:
65  typedef A< TC, int > Super;
66  typedef typename Super::C C; //Compile en rajoutant cette ligne (et en changeant les appels à Super::C par C)
67 
68  B( const C& c );
69 };
70 
71 template <typename TC>
72 inline
73 B<TC>::B( const C& c) : Super(c)
74 {
75  std::cout << "Specialized" << std::endl;
76 }
77 
78 
79 
80 int main( int /*argc*/, char** /*argv*/ )
81 {
82  B<int> a(1);
83 
84  return 0;
85 }
86 // //
int main(int, char **)