2453. §[iterator.range] and now [iterator.container] aren't available via <initializer_list>

Section: 21.9 [support.initlist], 27.7 [iterator.range], 27.8 [iterator.container] Status: New Submitter: Richard Smith Opened: 2014-11-11 Last modified: 2016-02-10

Priority: 3

View other active issues in [support.initlist].

View all other issues in [support.initlist].

View all issues with New status.

Discussion:

These sections define helper functions, some of which apply to initializer_list<T>. And they're available if you include one of a long list of header files, many of which include <initializer_list>. But they are not available if you include <initializer_list>. This seems very odd.

#include <initializer_list>
auto x = {1, 2, 3};
const int *p = data(x); // error, undeclared
#include <vector>
const int *q = data(x); // ok

Proposed resolution: