您当前的位置: 首页 >  c++
  • 0浏览

    0关注

    1477博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

C++ std::set emplace 返回值 first second

软件工程小施同学 发布时间:2021-10-20 11:22:31 ,浏览量:0

emplace返回值

一个pair 

  • 逻辑组件如果已插入那就是真的, 如果映射已经包含值相同地排序的元素就是假的.  
  • 返回值的迭代器元素对返回插入新元素的地址 (如果 bool 元素为 true) 或已找到其中的元素 (如果 bool 元素是假)。 

If the function successfully inserts the element (because no equivalent element existed already in the set), the function returns a pair of an iterator to the newly inserted element and a value of true. Otherwise, it returns an iterator to the equivalent element within the container and a value of false. Member type iterator is a bidirectional iterator type that points to an element.pair is a class template declared in  (see pair).

set::emplace - C++ Reference

// set_emplace.cpp
// compile with: /EHsc
#include 
#include 
#include 

using namespace std;

template  void print(const S& s) {
    cout             
关注
打赏
1665320866
查看更多评论
0.0399s