In addition to Praetorian’s correct answer (which I’ve upvoted), I wanted to add a little more information…
Post-C++14, the standard has been changed to allow:
tuple<int, int> t2={1, 2};
to compile and have the expected semantics. The proposal that does this is N4387. This will also allow constructs such as:
tuple<int, int>
foo()
{
return {1, 2};
}
It only allows it if all T
in the tuple
are implicitly contructible from all arguments.
As a non-conforming extension, libc++ already implements this behavior.