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

后端 未结 7 1311
借酒劲吻你
借酒劲吻你 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:36

    starting from c++11 just use uniform initialization for pairs. So instead of:

    std::make_pair(1, 2);
    

    or

    std::pair(1, 2);
    

    just use

    {1, 2};
    

提交回复
热议问题