Issue 3530: BUILTIN-PTR-MEOW should not opt the type out of syntactic checks (original) (raw)
-1- In this subclause, _BUILTIN-PTR-CMP_(T,
op, U)
for types T
and U
and where op is an equality (7.6.10 [expr.eq]) or relational operator (7.6.9 [expr.rel]) is a boolean constant expression._BUILTIN-PTR-CMP_(T,
op, U)
is true if and only if op in the expressiondeclval<T>()
op declval<U>()
resolves to a built-in operator comparing pointers.
struct ranges::equal_to {
template<class T, class U>
requires equality_comparable_with<T, U> || BUILTIN-PTR-CMP(T, ==, U)
constexpr bool operator()(T&& t, U&& u) const;
using is_transparent = unspecified; };
template<class T, class U>
requires equality_comparable_with<T, U> || BUILTIN-PTR-CMP(T, ==, U)
constexpr bool operator()(T&& t, U&& u) const;
-?- Constraints:
T
andU
satisfyequality_comparable_with
.-2- Preconditions: If the expression
std::forward<T>(t) == std::forward<U>(u)
results in a call to a built-in operator==
comparing pointers of typeP
, the conversion sequences from bothT
andU
toP
are equality-preserving (18.2 [concepts.equality]); otherwise,T
andU
modelequality_comparable_with
.-3- Effects:
- (3.1) — If the expression
std::forward<T>(t) == std::forward<U>(u)
results in a call to a built-in operator==
comparing pointers of typeP
, returnsfalse
if either (the converted value of)t
precedesu
oru
precedest
in the implementation-defined strict total order over pointers (3.28 [defns.order.ptr]) and otherwisetrue
.- (3.2) — Otherwise, equivalent to:
return std::forward<T>(t) == std::forward<U>(u);
struct ranges::not_equal_to {
template<class T, class U>
requires equality_comparable_with<T, U> || BUILTIN-PTR-CMP(T, ==, U)
constexpr bool operator()(T&& t, U&& u) const;
using is_transparent = _unspecified_;
};
template<class T, class U> constexpr bool operator()(T&& t, U&& u) const;
-?- Constraints:
T
andU
satisfyequality_comparable_with
.-4-
Effects: Equivalent to:operator()
has effects ereturn !ranges::equal_to{}(std::forward(t), std::forward(u));
struct ranges::greater {
template<class T, class U>
requires totally_ordered_with<T, U> || BUILTIN-PTR-CMP(T, <, U)
constexpr bool operator()(T&& t, U&& u) const;
using is_transparent = unspecified; };
template<class T, class U> constexpr bool operator()(T&& t, U&& u) const;
-?- Constraints:
T
andU
satisfytotally_ordered_with
.-5-
Effects: Equivalent to:operator()
has effects ereturn ranges::less{}(std::forward(u), std::forward(t));
struct ranges::less {
template<class T, class U>
requires totally_ordered_with<T, U> || BUILTIN-PTR-CMP(T, <, U)
constexpr bool operator()(T&& t, U&& u) const;
using is_transparent = unspecified; };
template<class T, class U>
requires totally_ordered_with<T, U> || BUILTIN-PTR-CMP(T, <, U)
constexpr bool operator()(T&& t, U&& u) const;
-?- Constraints:
T
andU
satisfytotally_ordered_with
.-6- Preconditions: If the expression
std::forward<T>(t) < std::forward<U>(u)
results in a call to a built-in operator<
comparing pointers of typeP
, the conversion sequences from bothT
andU
toP
are equality-preserving (18.2 [concepts.equality]); otherwise,T
andU
modeltotally_ordered_with
. For any expressionsET
andEU
such thatdecltype((ET))
isT
anddecltype((EU))
isU
, exactly one ofranges::less{}(ET, EU)
,ranges::less{}(EU, ET)
, orranges::equal_to{}(ET, EU)
istrue
.-7- Effects:
- (7.1) — If the expression
std::forward<T>(t) < std::forward<U>(u)
results in a call to a built-in operator<
comparing pointers of typeP
, returnstrue
if (the converted value of)t
precedesu
in the implementation-defined strict total order over pointers (3.28 [defns.order.ptr]) and otherwisefalse
.- (7.2) — Otherwise, equivalent to:
return std::forward<T>(t) < std::forward<U>(u);
struct ranges::greater_equal {
template<class T, class U>
requires totally_ordered_with<T, U> || BUILTIN-PTR-CMP(T, <, U)
constexpr bool operator()(T&& t, U&& u) const;
using is_transparent = unspecified; };
template<class T, class U> constexpr bool operator()(T&& t, U&& u) const;
-?- Constraints:
T
andU
satisfytotally_ordered_with
.-8-
Effects: Equivalent to:operator()
has effects ereturn !ranges::less{}(std::forward(t), std::forward(u));
struct ranges::less_equal {
template<class T, class U>
requires totally_ordered_with<T, U> || BUILTIN-PTR-CMP(T, <, U)
constexpr bool operator()(T&& t, U&& u) const;
using is_transparent = unspecified; };
template<class T, class U> constexpr bool operator()(T&& t, U&& u) const;
-?- Constraints:
T
andU
satisfytotally_ordered_with
.-9-
Effects: Equivalent to:operator()
has effects ereturn !ranges::less{}(std::forward(u), std::forward(t));