|
|
g++ -Wall -Wextra -Wpedantic -g prog.cpp -o prog |
g++ (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 8.1.0 |
type min_example.txt | prog |
1.63742117468.30756.842 1.63742117468.30756.850 1.63742117468.30756.82 1.63742117468.30756.858 1.63742117468.30756.866 1.63742117468.30756.874 1.63742117468.30756.882 1.63742117468.30756.890 1.63742117468.30756.898 1.63742117468.30756.906 1.63742117468.30756.914 1.63742117468.30756.922 1.63742117468.30756.930 1.63742117468.30756.90 1.63742117468.30756.938 1.63742117468.30756.946 1.63742117468.30756.954 1.63742117468.30756.962 1.63742117468.30756.970 1.63742117468.30756.978 1.63742117468.30756.986 1.63742117468.30756.994 1.63742350331.23832.16086 1.63742350331.23832.16086 1.63742350331.23832.16086 1.63742350331.23832.16086 1.63742350331.23832.16086 1.63742350331.23832.16086 1.63742350331.23832.16086 1.63742350331.23832.16086 |
>gdb prog GNU gdb (GDB) 8.1 Copyright (C) 2018 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-w64-mingw32". Type "show configuration" for configuration details. For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from prog...done. (gdb) run < min_example.txt Starting program: [redacted]\prog.exe < min_example.txt [New Thread 13624.0x2a64] [New Thread 13624.0x8cc] [New Thread 13624.0x3d0c] [New Thread 13624.0x320] 1.63742350331.23832.16086 1.63742350331.23832.16086 1.63742350331.23832.16086 1.63742350331.23832.16086 1.63742350331.23832.16086 1.63742350331.23832.16086 1.63742350331.23832.16086 -17891602.-76843841185972498.793867558.805456004 1.63742117468.30756.82 1.63742117468.30756.90 1.63742117468.30756.842 1.63742117468.30756.850 1.63742117468.30756.858 1.63742117468.30756.866 1.63742117468.30756.874 1.63742117468.30756.882 1.63742117468.30756.890 1.63742117468.30756.898 1.63742117468.30756.906 1.63742117468.30756.914 1.63742117468.30756.922 1.63742117468.30756.930 1.63742117468.30756.938 1.63742117468.30756.946 1.63742117468.30756.954 1.63742117468.30756.962 1.63742117468.30756.970 1.63742117468.30756.978 1.63742117468.30756.986 1.63742117468.30756.994 warning: Critical error detected c0000374 Thread 1 received signal SIGTRAP, Trace/breakpoint trap. 0x00007fff7e8c759f in ntdll!RtlIsNonEmptyDirectoryReparsePointAllowed () from C:\Windows\SYSTEM32\ntdll.dll (gdb) |
(gdb) where #0 0x00007fff7e8c759f in ntdll!RtlIsNonEmptyDirectoryReparsePointAllowed () from C:\Windows\SYSTEM32\ntdll.dll #1 0x00007fff7e8cdd9a in ntdll!RtlpNtSetValueKey () from C:\Windows\SYSTEM32\ntdll.dll #2 0x00007fff7e874eb2 in wcstok_s () from C:\Windows\SYSTEM32\ntdll.dll #3 0x00007fff7e888b94 in ntdll!memset () from C:\Windows\SYSTEM32\ntdll.dll #4 0x00007fff7b83995c in msvcrt!free () from C:\Windows\System32\msvcrt.dll #5 0x0000000000402e80 in __gnu_cxx::new_allocator<Foo>::deallocate (this=0x62fe10, __p=0x25434d0) at C:/mingw64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/ext/new_allocator.h:125 #6 0x000000000040369b in std::allocator_traits<std::allocator<Foo> >::deallocate (__a=..., __p=0x25434d0, __n=32) at C:/mingw64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/alloc_traits.h:462 #7 0x0000000000403582 in std::_Vector_base<Foo, std::allocator<Foo> >::_M_deallocate (this=0x62fe10, __p=0x25434d0, __n=32) at C:/mingw64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/stl_vector.h:304 #8 0x000000000040360f in std::_Vector_base<Foo, std::allocator<Foo> >::~_Vector_base (this=0x62fe10, __in_chrg=<optimized out>) at C:/mingw64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/stl_vector.h:285 #9 0x0000000000403c51 in std::vector<Foo, std::allocator<Foo> >::~vector (this=0x62fe10, __in_chrg=<optimized out>) at C:/mingw64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/bits/stl_vector.h:570 #10 0x0000000000401679 in main () at prog.cpp:45 |
|
|
lhs.version < rhs.version
is true you want to return true but if lhs.version > rhs.version
is true you definitely want to return false but right now you instead go on and compare other values which might end up returning either true or false. This is likely to lead to an inconsistent ordering.
|
|
|
|
|
|
|
|
|
|
|
|
For all algorithms that take Compare, there is a version that uses operator< instead. That is, comp(*i, *j) != false defaults to *i < *j != false. For algorithms other than those described in 28.7.3, comp shall induce a strict weak ordering on the values. |