What is the purpose of std::make_pair vs the constructor of std::pair?

后端 未结 7 1292
借酒劲吻你
借酒劲吻你 2020-12-04 06:04

What is the purpose of std::make_pair?

Why not just do std::pair(0, \'a\')?

Is there any difference between the tw

7条回答
  •  执笔经年
    2020-12-04 06:18

    As @MSalters replied above, you can now use curly braces to do this in C++11 (just verified this with a C++11 compiler):

    pair p = {1, 2};
    

提交回复
热议问题