| 1 |
// { dg-do compile { target c++11 } } |
| 2 |
template<typename...> class tuple { }; |
| 3 |
|
| 4 |
template<typename T, template<typename U> class... Metafunctions> |
| 5 |
struct apply_all |
| 6 |
{ |
| 7 |
typedef tuple<typename Metafunctions<T>::type...> type; |
| 8 |
}; |
| 9 |
|
| 10 |
template<typename T, typename U> |
| 11 |
struct is_same { |
| 12 |
static const bool value = false; |
| 13 |
}; |
| 14 |
|
| 15 |
template<typename T> |
| 16 |
struct is_same<T, T> { |
| 17 |
static const bool value = true; |
| 18 |
}; |
| 19 |
|
| 20 |
template<typename T> |
| 21 |
struct add_pointer { |
| 22 |
typedef T* type; |
| 23 |
}; |
| 24 |
|
| 25 |
template<typename T> |
| 26 |
struct add_pointer<T&> |
| 27 |
{ |
| 28 |
typedef T& type; |
| 29 |
}; |
| 30 |
|
| 31 |
template<typename T> |
| 32 |
struct add_reference { |
| 33 |
typedef T& type; |
| 34 |
}; |
| 35 |
|
| 36 |
template<typename T> |
| 37 |
struct add_reference<T&> |
| 38 |
{ |
| 39 |
typedef T& type; |
| 40 |
}; |
| 41 |
|
| 42 |
int a0[is_same<apply_all<int>::type,tuple<> >::value? 1 : -1]; |
| 43 |
int a1[is_same<apply_all<int, add_pointer>::type,tuple<int*> >::value? 1 : -1]; |
| 44 |
int a2[is_same<apply_all<int, add_pointer, add_reference>::type,tuple<int*, int&> >::value? 1 : -1]; |
| 45 |
int a3[is_same<apply_all<int&, add_pointer, add_reference>::type,tuple<int&, int&> >::value? 1 : -1]; |
| 46 |
|
| 47 |
|