Initializer_list in visual studio 2012

I found that the initializer_list file is not supported by MSVC 2012. But can it (initializer_list) be used in VS somehow (for example, using the Boost library). Samples, if you can, please.

+4
source share
1 answer

Boost :: assign is as close as possible.

In particular, assign :: list_of probably looks like the behavior you are looking for.

// Examples from the documentation: const list<int> primes = list_of(2)(3)(5)(7)(11); const stack<string> names = list_of( "Mr. Foo" )( "Mr. Bar")( "Mrs. FooBar" ).to_adapter(); map<int,int> next = map_list_of(1,2)(2,3)(3,4)(4,5)(5,6); 
+6
source

Source: https://habr.com/ru/post/1440225/


All Articles