libstdc++: Micro-optimisations for lexicographical_compare_three_way
As noted in LWG 3410 the specification in the C++20 draft performs more iterator comparisons than necessary when the end of either range is reached. Our implementation followed that specification. This removes the redundant comparisons so that we do no unnecessary work as soon as we find that we've reached the end of either range. The odd-looking return statement is because it generates better code than the original version that copied the global constants. * include/bits/stl_algobase.h (lexicographical_compare_three_way): Avoid redundant iterator comparisons (LWG 3410).
Showing
Please
register
or
sign in
to comment