1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
|
// NE COMPILE PAS
// Les pointeurs man et woman sont censés être initialisés dans main
template< typename T = void, typename U = void >
struct Dummy;
/** Crazy template and his specialisations */
template< typename T = void, typename U = void >
struct Crazy
{
Dummy< T, U >* man;
void Hello(T t, U u);
};
template< typename T, typename U >
void Crazy< T, U >::Hello(T t, U u)
{
man->Bingo(t,u);
}
template< typename T >
struct Crazy< T >
{
Dummy< T >* man;
void Hello(T t);
};
template< typename T >
void Crazy< T >::Hello(T t)
{
man->Bingo(t);
}
template< >
struct Crazy< >
{
Dummy< >* man;
void Hello();
};
void Crazy< >::Hello()
{
man->Bingo();
}
/** Dummy template and his specialisations */
template< typename T, typename U >
struct Dummy
{
Crazy< T, U >* woman;
void Hello(T t, U u);
void Bingo(T t, U u);
};
template< typename T, typename U >
void Dummy< T, U >::Hello(T t, U u)
{
woman->Hello(t,u);
}
template< typename T, typename U >
void Dummy< T, U >::Bingo(T t, U u)
{
// ...
}
template< typename T >
struct Dummy< T >
{
Crazy< T >* woman;
void Hello(T t);
void Bingo(T t);
};
template< typename T >
void Dummy< T >::Hello(T t)
{
woman->Hello(t);
}
template< typename T >
void Dummy< T >::Bingo(T t)
{
// ...
}
template< >
struct Dummy< >
{
Crazy< >* woman;
void Hello();
void Bingo();
};
void Dummy< >::Hello()
{
woman->Hello();
}
void Dummy< >::Bingo()
{
// ...
}
int main(int argc, char** argv)
{
// ...
} |
Partager