#Converting 2D std::initializer_list to 2D std::vector

1 messages · Page 1 of 1 (latest)

fathom frost
#

I'm trying to create a generic wrapper around a 2D vector, and so need to convert a std::initializer_list<std::initializer_list<T>> to a std::vector<std::vector<T>>. I already tried these three approaches:

vec = std::vector<std::vector<T>>{initList};
vec = std::vector{initList};
vec = initList;

But none of them work. Could someone please tell me what I could do to convert it efficiently?

gaunt urchinBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.

crisp moss
#

you can change it to std::initializer_list<std::vector<T>>

fathom frost
#

can I not have an initializer list of initializer lists?

#

cuz then its much more general

fathom frost
#

nvm i fixed it

#

it was a completely different issue

#

!solved