首页 > 技术文章 > list<pair<int,int>> 的 push_front 与 emplace_front

0patrick 2021-01-13 20:41 原文

 

    list<pair<int,int>> li ;
    li.push_front({23,1});    //对
    li.emplace_front(23,1);    //对
    //li.push_front(1,2) ;    //错
    //li.emplace_front({1,2}) ; //错
    li.emplace_front(make_pair(1,2));  //对
    li.push_front(make_pair(23,1));   //对

 

推荐阅读