std::initializer_list as function argument

后端 未结 4 624
野性不改
野性不改 2020-12-13 06:54

For some reason I thought C++0x allowed std::initializer_list as function argument for functions that expect types that can be constructed from such, for exampl

4条回答
  •  情书的邮戳
    2020-12-13 07:13

    It seems to work this way:

    function( {std::string("hello"), std::string("world"), std::string("test")} );
    

    Perhaps it is a compiler bug, but perhaps you are asking for too many implicit conversions.

提交回复
热议问题