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

前端 未结 6 2200
再見小時候
再見小時候 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:34

    This is nothing new. For example, for (i : some_container) relies on existence of specific methods or standalone functions in some_container class. C# even relies even more on its .NET libraries. Actually, I think, that this is quite an elegant solution, because you can make your classes compatible with some language structures without complicating language specification.

提交回复
热议问题