initializer list - Why are these C++ headers specified to include <initializer_list>? -


as can seen https://stackoverflow.com/a/26614984/481267 following headers guaranteed standard #include <initializer_list>:

  • everything in [containers]
  • <utility>
  • <string>
  • <algorithm>
  • <random>
  • <valarray>
  • <regex>

most of these headers declare @ least 1 function takes std::initializer_list<e> argument, makes sense. however,

  • <array>, <stack>, , <queue> have no such functions, although perhaps makes sense treat containers uniformly here.
  • <utility> has no such functions.
  • <iterator> have functions initializer_list argument (rbegin, rend) it's not specified include <initializer_list>.

what rationale behind these exceptions?

seems there no explicit rationale, proposals additions standard made , proposals accepted.

at end of document n2672 initializer list proposed wording says:

in 20.2 utility components [utility] paragraph 1:

this subclause contains basic function , class templates used throughout rest of library.

header <utility> synopsis

     #include<initializer_list>       namespace std { 

so, authors of paper saw initializer_list utility, , ought included <utility> header. , therefore is.

the paper didn't propose changes <iterator> header, none made.