returning initializer list mechanism

后端 未结 2 616

What mechanism is involved, if when returning types, that are constructible from initializer lists, I don\'t specify the type I am returning, as in:

std::arr         


        
2条回答
  •  半阙折子戏
    2021-01-01 22:57

    There are no performance penalties involved. The return value is constructed equivalent to

    std::array x = { 1, 2, 3 };
    

    There is not even a single copy or move of an std::array instance involved.

提交回复
热议问题