Question for standard gurus.
Trying to answer another question , I doubted the correctness of the code.
As far as I know, the following code is poorly formed
int main ()
{
std::tuple<> a;
std::get<0>(a);
}
because the call std::get<I>(t)
when t
a std::tuple<Ts...>
poorly formed when I
out of range [0, sizeof...(Ts)[
.
In this case, it sizeof...(Ts)
is equal to zero, therefore the range is [0, 0[
empty, therefore it is std::get<I>(a)
poorly formed for each index I
.
But when std::get<I>(a)
expanded through empty variation packaging?
I mean: the following code
#include <tuple>
template <typename ... Args>
void bar (Args const & ...)
{ }
template <std::size_t ... I>
void foo ()
{
std::tuple<> a;
bar( std::get<I>(a) ... );
}
int main ()
{
foo<>();
}
(?) (std::get<I>(a)
), (sizeof...(I)
), ?