Avoid requiring default-constructability of iterator type in algorithms that use ContainerIterPairType

This includes absl::c_minmax_element, absl::c_equal_range, and absl::mismatch

PiperOrigin-RevId: 756846820
Change-Id: I39f612224a98947f5ef9e9b7e53320df0bd99ce7
This commit is contained in:
Abseil Team
2025-05-09 11:39:53 -07:00
committed by Copybara-Service
parent 0710718aca
commit 3eb2041985

View File

@@ -75,8 +75,8 @@ using ContainerIter = decltype(begin(std::declval<C&>()));
// An MSVC bug involving template parameter substitution requires us to use
// decltype() here instead of just std::pair.
template <typename C1, typename C2>
using ContainerIterPairType =
decltype(std::make_pair(ContainerIter<C1>(), ContainerIter<C2>()));
using ContainerIterPairType = decltype(std::make_pair(
std::declval<ContainerIter<C1>>(), std::declval<ContainerIter<C2>>()));
template <typename C>
using ContainerDifferenceType = decltype(std::distance(