std::sort
requires a sorter which satisfies the strict weak ordering rule, which is explained
here
So, your comparer says that a < b
when a == b
which doesn’t follow the strict weak ordering rule, it is possible that the algorithm will crash because it’ll enter in an infinite loop.
More Related Contents:
- find the number of times a character occurs between two indexes
- Which is the fastest algorithm to find prime numbers?
- Why are Standard iterator ranges [begin, end) instead of [begin, end]?
- C++ display stack trace on exception
- Rounding up to the nearest multiple of a number
- Finding all the subsets of a set
- Deprecation of the static keyword… no more?
- Efficient implementation of log2(__m256d) in AVX2
- Using Unicode in C++ source code
- Is `long` guaranteed to be at least 32 bits?
- Are all integer values perfectly represented as doubles? [duplicate]
- Why do compilers allow string literals not to be const?
- Why don’t the C or C++ standards explicitly define char as signed or unsigned?
- C++: Converting Hexadecimal to Decimal
- Printing prime numbers from 1 through 100
- Why the sizeof(bool) is not defined to be one, by the Standard itself?
- Circular lock-free buffer
- Generating m distinct random numbers in the range [0..n-1]
- Are there stackless or heapless implementation of C++?
- Windows/C++: Is it possible to find the line of code where exception was thrown having “Exception Offset”
- Is it legal to use the increment operator in a C++ function call?
- is it ok to specialize std::numeric_limits for user-defined number-like classes?
- boost thread throwing exception “thread_resource_error: resource temporarily unavailable”
- Efficiently getting all divisors of a given number
- Does throw inside a catch ellipsis (…) rethrow the original error in C++?
- Is it more efficient to copy a vector by reserving and copying, or by creating and swapping? [duplicate]
- Why there is no std::copy_if algorithm?
- Why must a std::ranges::filter_view object be non-const for querying its elements?
- Why is a segmentation fault not recoverable?
- is size_t always unsigned?