| 1 |
// { dg-do compile { target c++11 } } |
| 2 |
template<typename T> |
| 3 |
struct uncvref |
| 4 |
{ |
| 5 |
typedef T type; |
| 6 |
}; |
| 7 |
|
| 8 |
template<typename... Args> |
| 9 |
struct args |
| 10 |
{ |
| 11 |
static const int size = sizeof...(Args); |
| 12 |
}; |
| 13 |
|
| 14 |
template<typename G, typename E, typename S, typename V, long GN = G::size, long EN = E::size> |
| 15 |
struct apply_args; |
| 16 |
|
| 17 |
template<typename... G, typename... E, typename S, typename V, long N> |
| 18 |
struct apply_args<args<G...>, args<E...>, S, V, N, N> |
| 19 |
{ |
| 20 |
typedef args< |
| 21 |
typename G::template apply<typename uncvref<E>::type, S, V>::type... |
| 22 |
> type; |
| 23 |
}; |
| 24 |
|
| 25 |
struct or_ |
| 26 |
{ |
| 27 |
template<typename E, typename S, typename V> |
| 28 |
struct apply { |
| 29 |
typedef typename E::type type; |
| 30 |
}; |
| 31 |
}; |
| 32 |
|
| 33 |
template<typename T> |
| 34 |
struct identity |
| 35 |
{ |
| 36 |
typedef T type; |
| 37 |
}; |
| 38 |
|
| 39 |
apply_args<args<or_>, args<identity<int>>, float, double> a1; |