C++ std::multiset返回值 has no member named ‘first’

Posted 软件工程小施同学

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了C++ std::multiset返回值 has no member named ‘first’相关的知识,希望对你有一定的参考价值。

error: ‘std::multiset<>::iterator {aka struct std::_Rb_tree_const_iterator<>}’ has no member named ‘first’
 

multiset返回的直接是迭代器,所以没有first

// INTEGER EXAMPLE 
// CPP program to illustrate 
// Implementation of emplace() function 
#include <iostream> 
#include <set> 
using namespace std; 
  
int main() 
{ 
    multiset<int> mymultiset{}; 
    auto result = mymultiset.emplace(3); 
    cout << ' ' << (*result); 
  
    // printing the multiset 
    for (auto it = mymultiset.begin(); 
         it != mymultiset.end(); ++it) 
        cout << ' ' << *it; 
    return 0; 
}

multiset::emplace - 游戏蛮牛 - C++中文翻译用户手册

以上是关于C++ std::multiset返回值 has no member named ‘first’的主要内容,如果未能解决你的问题,请参考以下文章