Skip to content

Commit

Permalink
Define minimum/maximum return type using a ternary
Browse files Browse the repository at this point in the history
Note that the decltype() only describes the return type of the operator, so it
doesn't actually constrain the implementation of the operator.
  • Loading branch information
Pennycook committed Oct 25, 2024
1 parent 5ae4b13 commit 0308265
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions adoc/chapters/programming_interface.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -21499,7 +21499,7 @@ _Returns_: The smaller value, or [code]#x# if the arguments are equivalent.
[source,role=synopsis,id=api:minimum-transparent-call-operator]
----
template <class T, class U> constexpr auto operator()(T&& t, U&& u) const
-> /* see below */;
-> decltype(std::forward<U>(u) < std::forward<T>(t) ? std::forward<U>(u) : std::forward<T>(t));
----

_Returns_: The smaller value, or [code]#t# if the arguments are equivalent.
Expand Down Expand Up @@ -21528,7 +21528,7 @@ _Returns_: The larger value, or [code]#x# if the arguments are equivalent.
[source,role=synopsis,id=api:maximum-transparent-call-operator]
----
template <class T, class U> constexpr auto operator()(T&& t, U&& u) const
-> /* see below */;
-> decltype(std::forward<T>(t) < std::forward<U>(u) ? std::forward<U>(u) : std::forward<T>(t));
----

_Returns_: The larger value, or [code]#t# if the arguments are equivalent.
Expand Down
2 changes: 1 addition & 1 deletion adoc/headers/functional/maximum.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ template <typename T = void> struct maximum {

template <> struct maximum<void> {
template <class T, class U> constexpr auto operator()(T&& t, U&& u) const
-> /* see below */;
-> decltype(std::forward<T>(t) < std::forward<U>(u) ? std::forward<U>(u) : std::forward<T>(t));

using is_transparent = /* unspecified */;
};
Expand Down
2 changes: 1 addition & 1 deletion adoc/headers/functional/minimum.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ template <typename T = void> struct minimum {

template <> struct minimum<void> {
template <class T, class U> constexpr auto operator()(T&& t, U&& u) const
-> /* see below */;
-> decltype(std::forward<U>(u) < std::forward<T>(t) ? std::forward<U>(u) : std::forward<T>(t));

using is_transparent = /* unspecified */;
};
Expand Down

0 comments on commit 0308265

Please sign in to comment.