Why isn't std::initializer_list a language built-in?

前端 未结 6 2201
再見小時候
再見小時候 2020-12-12 15:39

Why isn\'t std::initializer_list a core-language built-in?

It seems to me that it\'s quite an important feature of C++11 and yet it doesn\'t have its

6条回答
  •  旧巷少年郎
    2020-12-12 16:18

    This is indeed nothing new and how many have pointed out, this practice was there in C++ and is there, say, in C#.

    Andrei Alexandrescu has mentioned a good point about this though: You may think of it as a part of imaginary "core" namespace, then it'll make more sense.

    So, it's actually something like: core::initializer_list, core::size_t, core::begin(), core::end() and so on. This is just an unfortunate coincidence that std namespace has some core language constructs inside it.

提交回复
热议问题