[LLVMbugs] [Bug 22993] stl::sort cannot sort globally declared vector of struct type

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Mar 23 05:46:58 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=22993

Dimitry Andric <dimitry at andric.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |dimitry at andric.com
         Resolution|---                         |INVALID

--- Comment #1 from Dimitry Andric <dimitry at andric.com> ---
You should write EDGE::operator() so that it returns true only if one element
is less than another, not less than or equal.  E.g, the semantics should be
"<", not "<=":

   bool operator () (EDGE const& a, EDGE const& b) const {
      return a.c < b.c;
   }

With that in place, the program will work as you expected.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150323/1eacde6f/attachment.html>


More information about the llvm-bugs mailing list