Consider this code:
constexpr std::size_t the_length;
template <EnumType T>
int function()
{
std::array<T, the_length> x;
//some code here that uses x
}
I would like the length of array x to have a different value based on the type T. For example if T can take 2 values, I would like the_length to have value 10 if T is of the first kind, and a value of 20 if it is of the second type. Can this be done in C++11? Thanks
Aucun commentaire:
Enregistrer un commentaire