template <typename T> struct X; template<int I> struct Y;
X<X<int>> *x1;
Y<(1 >> 2)> *y1;
Y<1 >> 2> *y2;
X<X<X<X<X<int>>>>> *x2;
template<> struct X<int> { };
typedef X<int> X_int;
struct Z : X_int { };
void f(const X<int> x) {
(void)reinterpret_cast<X<int>>(x); (void)reinterpret_cast<X<X<X<int>>>>(x);
X<X<int>> *x1;
}
template<typename T = void> struct X1 { };
X1<X1<>> x1a;
namespace ParameterPackExpansions {
template<typename...Ts> struct Outer {
template<Ts ...As, template<Ts> class ...Bs, typename ...Cs> struct Inner {
struct Check : Bs<As>... {
Check(Cs...);
};
};
};
template<int> struct TemplateInt {};
template<char> struct TemplateChar {};
template<int*> struct TemplateIntPtr {};
int x;
Outer<int, char, int*>::
Inner<12345, 'x', &x,
TemplateInt, TemplateChar, TemplateIntPtr,
int*>::
Check check(&x);
template<typename...Ts> struct types;
enum place { _ };
template<place...> struct places {};
template<typename P1, typename P2> struct append_places;
template<place...X1, place...X2>
struct append_places<places<X1...>, places<X2...>> {
typedef places<X1...,X2...> type;
};
template<unsigned N>
struct make_places : append_places<typename make_places<N/2>::type,
typename make_places<N-N/2>::type> {};
template<> struct make_places<0> { typedef places<> type; };
template<> struct make_places<1> { typedef places<_> type; };
template<typename T> struct wrap {
template<place> struct inner { typedef T type; };
};
template<typename T> struct takedrop_impl;
template<place...X> struct takedrop_impl<places<X...>> {
template<template<decltype(X)> class ...Take,
template<place > class ...Drop>
struct inner { typedef types<typename Take<_>::type...> take;
typedef types<typename Drop<_>::type...> drop;
};
};
template<unsigned N, typename...Ts> struct take {
using type = typename takedrop_impl<typename make_places<N>::type>::
template inner<wrap<Ts>::template inner...>::take; };
template<unsigned N, typename...Ts> struct drop {
using type = typename takedrop_impl<typename make_places<N>::type>::
template inner<wrap<Ts>::template inner...>::drop; };
using T1 = take<3, int, char, double, long>::type; using T1 = types<void, void, void, void>; using D1 = drop<3, int, char, double, long>::type;
using D1 = types<long>;
using T2 = take<4, int, char, double, long>::type; using T2 = types<void, void, void, void>; using T2 = types<int, char, double, long>;
using D2 = drop<4, int, char, double, long>::type;
using D2 = types<>;
using T3 = take<5, int, char, double, long>::type; using D3 = drop<5, int, char, double, long>::type;
template<typename ...Default> struct DefArg {
template<template<typename T = Default> class ...Classes> struct Inner { Inner(Classes<>...); };
};
template<typename T> struct vector {};
template<typename T> struct list {};
vector<int> vi;
list<char> lc;
DefArg<int, char>::Inner<vector, list> defarg(vi, lc);
template<typename...Ts, Ts...Vs> void error();
template<typename...Ts> void consume(Ts...);
template<typename...Ts> struct A {
template<template<typename, Ts = 0> class ...Cs, Cs<Ts> ...Vs> struct B { B() {
consume([]{
int arr[Vs]; }...);
}
};
};
template<typename, int> using Int = int;
template<typename, short> using Char = char;
A<int, short>::B<Int, Char, -1, 'x'> b;
}
namespace PR9023 {
template<typename ...T> struct A {
template<template<T> class ...> struct B {
};
};
template<int> struct C { };
template<long> struct D { };
int main() {
A<int, long>::B<C, D> e;
}
}
namespace std_examples {
template <class... Types> class Tuple;
template <class T, int... Dims> struct multi_array;
template <class... T> struct value_holder {
template<T... Values> struct apply { };
};
template <class... T, T... Values> struct static_array;
int n;
value_holder<int, char, int*>::apply<12345, 'x', &n> test;
}