c++data-structuresmultiset

How to print values in multiset?


How to access the values stored in the data structure multiset, C++?

for (int i = 0; i < mlt.size; i++)
{
cout << mlt[i];
}

Solution

  • If T is the type contained in your multiset,

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