Now, a tuple is neither a Sequence nor an Associative Container. In fact, a tuple isn’t even in the Containers Library section of the C++ 2011 Standard (Clause 23). Tuples are listed in Clause 20.4 . . . right after Pairs (Clause 20.3). Per 20.4.1[1], “tuples are heterogeneous, fixed-size collections of values.” Moreover, “an instantiation of tuple with two arguments is similar to an instantiation of pair with the same two arguments.” Unlike Containers that require “insert and erase operations” per 23.2.1[1] so that they can shrink and grow at run-time, tuples are fixed at compile-time . . . and since they’re fixed at compile-time, we’ll need to use a little bit of the power of the dark side, template meta-programming.
NOTE: In C++ 2011, some of the functionality associated with template meta-programming in C++ 1998/2003 has been replaced by Constant Expressions (Clause 5.19) . . . and Constant Expression Programming. __Some__ of the functionality, but not __all__. Wherever possible, use Constant Expression Programming, vice template meta-programming, since Constant Expressions were made from the ground up for compile-time programming … while being able to program with templates is just a side-effect of how templates are instantiated; moreover, template meta-programming was discovered to exist after the machinery of template instantiation was put in place … so the syntax is anything but user-friendly.
That being said, Constant Expression Programming doesn’t work here … or at least, I haven’t managed to get it to work here.