Рассмотрим эту программу С++ 11:
#include <iostream>
template <class A, class B = char> struct Cont {
Cont () { std::cout << sizeof(B); }
};
template <template<class, class = int> class C, class E> class Wrap1
{
C<E> ce;
};
template <template<class, class = int> class C, class... E> class Wrap2
{
C<E...> ce;
};
int main ()
{
Wrap1<Cont, void> w1;
Wrap2<Cont, void> w2;
}
При компиляции с помощью gcc или clang вывод 41
.
Это поведение соответствует стандарту? Где именно стандарт указывает его (для Wrap1
и Wrap2
)?
Этот вопрос частично вдохновлен другим вопросом.