lundi 30 octobre 2017

The type of a bracketed sequence

Let's consider the following code:

for(std::size_t j : {0,1,2,3,4,5,6,7})
{
   // do something with j
}

The question is: What will be the underlying type created by the compiler for the sequence {0,1,2,3,4,5,6,7} ?

Will it be a std::vector<T> and std::array<T, 8> or an std::initializer_list<T> ?

Where T is either int or std::size_t ...

Thanks for the help.

Aucun commentaire:

Enregistrer un commentaire