Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to access element in Multiset by index

How to access element in Multiset by index

Scheduled Pinned Locked Moved C / C++ / MFC
databasegraphicsdata-structurestutorialquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    alikalik
    wrote on last edited by
    #1

    Is it possible to access element by index (like in array or vector), when using multiset?

    C S 2 Replies Last reply
    0
    • A alikalik

      Is it possible to access element by index (like in array or vector), when using multiset?

      C Offline
      C Offline
      Chris Losinger
      wrote on last edited by
      #2

      no but you can walk through the collection with an iterator.

      image processing toolkits | batch image processing

      A 1 Reply Last reply
      0
      • A alikalik

        Is it possible to access element by index (like in array or vector), when using multiset?

        S Offline
        S Offline
        Sarath C
        wrote on last edited by
        #3

        as you've already started discussion on same topic, please continue your discussion in previous thread. multiset is a node based container. It's not implemented using contigeous memory allocation. Please check the documentation of multiset.

        -Sarath. "Great hopes make everything great possible" - Benjamin Franklin

        My blog - Sharing My Thoughts

        1 Reply Last reply
        0
        • C Chris Losinger

          no but you can walk through the collection with an iterator.

          image processing toolkits | batch image processing

          A Offline
          A Offline
          alikalik
          wrote on last edited by
          #4

          I found, that it is possible only to iterate in this way:

          multiset s;
          multiset::iterator it;

          it = s.begin();

          for (int i = 0; i < s.size(); ++i)
          it++;

          I tried to do the following:

          it += k;

          But that doesn't work. Is there any oppotunity to "jump" to the position?

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups