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. ATL / WTL / STL
  4. Why calling sort() crashes?

Why calling sort() crashes?

Scheduled Pinned Locked Moved ATL / WTL / STL
graphicshelpquestion
3 Posts 3 Posters 4 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.
  • K Offline
    K Offline
    Kumar Anitesh
    wrote on last edited by
    #1

    Could anyone please help me to find why call to sort() is crashing at run-time in following code block:

    string s = "Annnitttesrrh.";
    vector vecChar(s.begin(), s.end());
    sort(vecChar.begin(), vecChar.end(), greater_equal());

    Am i missing something very basic ?

    L T 2 Replies Last reply
    0
    • K Kumar Anitesh

      Could anyone please help me to find why call to sort() is crashing at run-time in following code block:

      string s = "Annnitttesrrh.";
      vector vecChar(s.begin(), s.end());
      sort(vecChar.begin(), vecChar.end(), greater_equal());

      Am i missing something very basic ?

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      See the remarks for sort[^] and strict weak[^].

      Veni, vidi, abiit domum

      1 Reply Last reply
      0
      • K Kumar Anitesh

        Could anyone please help me to find why call to sort() is crashing at run-time in following code block:

        string s = "Annnitttesrrh.";
        vector vecChar(s.begin(), s.end());
        sort(vecChar.begin(), vecChar.end(), greater_equal());

        Am i missing something very basic ?

        T Offline
        T Offline
        Theo Buys
        wrote on last edited by
        #3

        I think that equality don't work in sort. Why swap elements if they are equal?

        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