parent
db2767b644
commit
f5710887ad
|
@ -0,0 +1,10 @@
|
||||||
|
// Build don't link:
|
||||||
|
|
||||||
|
template <class T, int i>
|
||||||
|
struct S1;
|
||||||
|
|
||||||
|
template <class T, int i, int j>
|
||||||
|
struct S2
|
||||||
|
{
|
||||||
|
typedef typename S1<T, (i >= j ? 0 : 1) >::type type;
|
||||||
|
};
|
|
@ -0,0 +1,44 @@
|
||||||
|
// Build don't link:
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
struct Foo { };
|
||||||
|
|
||||||
|
template<class T1, class T2>
|
||||||
|
struct BT { };
|
||||||
|
|
||||||
|
template<class T1, class T2>
|
||||||
|
struct BT< Foo<T1>, Foo<T2> > { static const int i = 1; };
|
||||||
|
|
||||||
|
template<class T1, class T2>
|
||||||
|
struct BT< T1, Foo<T2> > { static const int i = 2; };
|
||||||
|
|
||||||
|
template<class T1, class T2>
|
||||||
|
struct BT< Foo<T1>, T2 > { static const int i = 3; };
|
||||||
|
|
||||||
|
template<class T1, class T2>
|
||||||
|
int foo(Foo<T1>, Foo<T2>)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T1, class T2>
|
||||||
|
int foo(T1, Foo<T2>)
|
||||||
|
{
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T1, class T2>
|
||||||
|
int foo(Foo<T1>, T2)
|
||||||
|
{
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
void f()
|
||||||
|
{
|
||||||
|
BT< double, Foo<int> >::i;
|
||||||
|
BT< Foo<int>, Foo<int> >::i;
|
||||||
|
BT< Foo<int>, float >::i;
|
||||||
|
foo(1.0, Foo<int>());
|
||||||
|
foo(Foo<int>(), Foo<int>());
|
||||||
|
foo(Foo<int>(), 1.0);
|
||||||
|
}
|
Loading…
Reference in New Issue