DGtal 1.4.0
Loading...
Searching...
No Matches
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
42template< typename TC, typename TD >
43class A
44{
45public:
46 typedef TC C;
47
48 A( const C& c );
49};
50
51template< typename TC, typename TD >
52inline
53A< TC, TD >::A( const C& c )
54{
55 boost::ignore_unused_variable_warning( c );
56 std::cout << "Generic" << std::endl;
57}
58
59
60
61template< typename TC > //int specialization
62class B : public A< TC, int >
63{
64public:
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
71template <typename TC>
72inline
73B<TC>::B( const C& c) : Super(c)
74{
75 std::cout << "Specialized" << std::endl;
76}
77
78
79
80int main( int /*argc*/, char** /*argv*/ )
81{
82 B<int> a(1);
83
84 return 0;
85}
86// //
int main()
Definition testBits.cpp:56