The suggested implementation of std::initializer_list in the standard and The C++ Programming Language are simple. By simple I mean there is nothing strange.
But things become complex in the Compilers implementation of std::initializer_list, for example, GCC has a private constructor for std::initializer_list with a comment above it which says: 'The compiler can call a private constructor.'.
Here eerorika answered:std::initializer_list is special. So I looked for it in the compilers source code:
Clang:
GCC:
And I don't understand why do we need to have a special private constructor? I encountered this some time ago when I wanted to convert std::vector<T> to std::initializer_list<T>.