tuple vector and initializer_list

The relevant std::tuple constructors are explicit. This means that what you want to do is not possible, since the syntax you want to use is defined in terms of copy initialization (which forbids calling an explicit constructor). In contrast, std::tuple<int, float, char> { 1, 2.2, 'X' } uses direct initialization. std::pair does have non-explicit constructors only.

Either use direct-initialization or one of the Standard tuple factory function (e.g. std::make_tuple).

Leave a Comment

tech