Вот:
Код: Выделить всё
template
struct Foo
{
const T value;
};
int main( )
{
Foo foo { .value = 5 }; // compiles
// Foo foo { .value = { 5 } }; // does not compile
// Foo foo { .value { 5 } }; // does not compile
}
Код: Выделить всё
: In function 'int main()':
:11:30: error: class template argument deduction failed:
11 | Foo foo { .value = { 5 } };
|
Подробнее здесь: https://stackoverflow.com/questions/784 ... ializers-w