如何在多组中打印值?

1 c++ multiset data-structures

如何访问存储在数据结构 multiset, C++ 中的值?

for (int i = 0; i < mlt.size; i++)
{
cout << mlt[i];
}
Run Code Online (Sandbox Code Playgroud)

Fre*_*Foo 5

如果T是您的多重集中包含的类型,

for (std::multiset<T>::const_iterator i(mlt.begin()), end(mlt.end());
     i != end;
     ++i)
    std::cout << *i << "\n";
Run Code Online (Sandbox Code Playgroud)