Talk:cpp/utility/initializer list
From cppreference.com
std::pair<const int*, size_t> c_arr() const {
return {&v[0], v.size()}; // list-initialization in return statement
}
Doesn't this example just call pair<const int*, size_t> constructor, without creating any initializer_list? What type would value_type be?
- True, this is an example of list-initialization. The author of the example just used that helper function to get some values, not to demonstrate initializer_list. I added a comment to the example, to hopefully make that clearer. --Cubbi 14:45, 5 December 2012 (PST)
- Shouldn't the first template parameter to std:pair be const T*? 92.22.189.245 01:57, 1 May 2013 (PDT)
- Yes, that makes more sense. Changed. --Cubbi 03:22, 1 May 2013 (PDT)