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. vector sort method

vector sort method

Scheduled Pinned Locked Moved C / C++ / MFC
graphicsquestion
5 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.
  • B Offline
    B Offline
    b rad311
    wrote on last edited by
    #1

    Hello, Is there any way of tracking what elements were moved where during a vector sort? Thanks,

    M 1 Reply Last reply
    0
    • B b rad311

      Hello, Is there any way of tracking what elements were moved where during a vector sort? Thanks,

      M Offline
      M Offline
      Maximilien
      wrote on last edited by
      #2

      Create a map (or something like that) of items vs. index before the sort, and create a map of items vs. index after the soft and compare both maps. I'm certain there are more smarter ways of doing it.

      Watched code never compiles.

      L 1 Reply Last reply
      0
      • M Maximilien

        Create a map (or something like that) of items vs. index before the sort, and create a map of items vs. index after the soft and compare both maps. I'm certain there are more smarter ways of doing it.

        Watched code never compiles.

        L Offline
        L Offline
        Luc Pattyn
        wrote on last edited by
        #3

        how about creating a clone of the vector before sorting it, then compare the clone with the sorted vector, one element at a time? :confused:

        Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


        Getting an article published on CodeProject now is hard and not sufficiently rewarded.


        M 1 Reply Last reply
        0
        • L Luc Pattyn

          how about creating a clone of the vector before sorting it, then compare the clone with the sorted vector, one element at a time? :confused:

          Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


          Getting an article published on CodeProject now is hard and not sufficiently rewarded.


          M Offline
          M Offline
          Maximilien
          wrote on last edited by
          #4

          yep, you see, smarter than me. :-D

          Watched code never compiles.

          L 1 Reply Last reply
          0
          • M Maximilien

            yep, you see, smarter than me. :-D

            Watched code never compiles.

            L Offline
            L Offline
            Luc Pattyn
            wrote on last edited by
            #5

            Not sure about smarter, my approach just is simpler, more straightforward. Keep it simple! :)

            Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


            Getting an article published on CodeProject now is hard and not sufficiently rewarded.


            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