aboutsummaryrefslogtreecommitdiff
path: root/libcpp/expr.cc
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2025-03-26 11:47:05 +0000
committerJonathan Wakely <redi@gcc.gnu.org>2025-04-04 12:56:59 +0100
commit03ac8886e5c1fa16da90276fd721a57fa9435f4f (patch)
tree1f75de5dd73ff9393f2937a7dd21b1ca54b7600d /libcpp/expr.cc
parent84d668b0ca67c5d3fe6430f101d61e60aa796a81 (diff)
downloadgcc-03ac8886e5c1fa16da90276fd721a57fa9435f4f.zip
gcc-03ac8886e5c1fa16da90276fd721a57fa9435f4f.tar.gz
gcc-03ac8886e5c1fa16da90276fd721a57fa9435f4f.tar.bz2
libstdc++: Replace use of __mindist in ranges::uninitialized_xxx algos [PR101587]
In r15-8980-gf4b6acfc36fb1f I introduced a new function object for finding the smaller of two distances. In bugzilla Hewill Kang pointed out that we still need to explicitly convert the result back to the right difference type, because the result might be an integer-like class type that doesn't convert to an integral type explicitly. Rather than doing that conversion in the __mindist function object, I think it's simpler to remove it again and just do a comparison and assignment. We always want the result to have a specific type, so we can just check if the value of the other type is smaller, and then convert that to the other type if so. libstdc++-v3/ChangeLog: PR libstdc++/101587 * include/bits/ranges_uninitialized.h (__detail::__mindist): Remove. (ranges::uninitialized_copy, ranges::uninitialized_copy_n) (ranges::uninitialized_move, ranges::uninitialized_move_n): Use comparison and assignment instead of __mindist. * testsuite/20_util/specialized_algorithms/uninitialized_copy/constrained.cc: Check with ranges that use integer-like class type for difference type. * testsuite/20_util/specialized_algorithms/uninitialized_move/constrained.cc: Likewise. Reviewed-by: Tomasz Kaminski <tkaminsk@redhat.com> Reviewed-by: Hewill Kang <hewillk@gmail.com>
Diffstat (limited to 'libcpp/expr.cc')
0 files changed, 0 insertions, 0 deletions