From c8b0fe29b1b01d16494a3a33a911d9f2a56c6a21 Mon Sep 17 00:00:00 2001 From: John Pennycook Date: Thu, 24 Oct 2024 12:14:17 +0100 Subject: [PATCH 1/5] Update function objects section to the new format Also fixes a bug in the return type of logical_and and logical_or. --- adoc/chapters/programming_interface.adoc | 314 ++++++++++++++++------- adoc/headers/functional.h | 42 --- adoc/headers/functional/bit_and.h | 17 ++ adoc/headers/functional/bit_or.h | 17 ++ adoc/headers/functional/bit_xor.h | 17 ++ adoc/headers/functional/logical_and.h | 17 ++ adoc/headers/functional/logical_or.h | 17 ++ adoc/headers/functional/maximum.h | 17 ++ adoc/headers/functional/minimum.h | 17 ++ adoc/headers/functional/multiplies.h | 17 ++ adoc/headers/functional/plus.h | 17 ++ 11 files changed, 370 insertions(+), 139 deletions(-) delete mode 100644 adoc/headers/functional.h create mode 100644 adoc/headers/functional/bit_and.h create mode 100644 adoc/headers/functional/bit_or.h create mode 100644 adoc/headers/functional/bit_xor.h create mode 100644 adoc/headers/functional/logical_and.h create mode 100644 adoc/headers/functional/logical_or.h create mode 100644 adoc/headers/functional/maximum.h create mode 100644 adoc/headers/functional/minimum.h create mode 100644 adoc/headers/functional/multiplies.h create mode 100644 adoc/headers/functional/plus.h diff --git a/adoc/chapters/programming_interface.adoc b/adoc/chapters/programming_interface.adoc index 2332823df..53ebf09f1 100644 --- a/adoc/chapters/programming_interface.adoc +++ b/adoc/chapters/programming_interface.adoc @@ -21277,142 +21277,262 @@ requirements for both host and device. SYCL provides a number of function objects in the [code]#sycl# namespace on host and device. -All function objects obey {cpp} conversion and promotion rules. -Each function object is additionally specialized for [code]#void# as a -_transparent_ function object that deduces its parameter types and return type. -[source,,linenums] +==== [code]#plus# class template + +[source,role=synopsis] ---- -include::{header_dir}/functional.h[lines=4..-1] +include::{header_dir}/functional/plus.h[lines=4..-1] ---- -[[table.function.objects.plus]] -.Member functions for the [code]#plus# function object -[width="100%",options="header",separator="@",cols="65%,35%"] -|==== -@ Member function @ Description -a@ -[source] +''' + +.[apititle]#call operator# +[source,role=synopsis,id=api:plus-call-operator] ---- -T operator()(const T& x, const T& y) const +T operator()(const T& x, const T& y) const; ---- - a@ Returns the sum of its arguments, equivalent to [code]#pass:[x + y]#. -|==== +_Returns_: [code]#pass:[x + y]#. -[[table.function.objects.multiplies]] -.Member functions for the [code]#multiplies# function object -[width="100%",options="header",separator="@",cols="65%,35%"] -|==== -@ Member function @ Description -a@ -[source] +''' + +.[apititle]#transparent call operator# +[source,role=synopsis,id=api:plus-transparent-call-operator] ---- -T operator()(const T& x, const T& y) const +template constexpr auto operator()(T&& t, U&& u) const + -> decltype(std::forward(t) + std::forward(u)); ---- - a@ Returns the product of its arguments, equivalent to [code]#x * y#. -|==== +// Strange formatting here because + requires pass, but pass breaks /. +_Returns_: [code]#std::forward(t)# [code]#pass:[+]# [code]#std::forward(u)#. -[[table.function.objects.bit-and]] -.Member functions for the [code]#bit_and# function object -[width="100%",options="header",separator="@",cols="65%,35%"] -|==== -@ Member function @ Description -a@ -[source] +==== [code]#multiplies# class template + +[source,role=synopsis] ---- -T operator()(const T& x, const T& y) const +include::{header_dir}/functional/multiplies.h[lines=4..-1] ---- - a@ Returns the bitwise AND of its arguments, equivalent to [code]#x & y#. -|==== +''' -[[table.function.objects.bit-or]] -.Member functions for the [code]#bit_or# function object -[width="100%",options="header",separator="@",cols="65%,35%"] -|==== -@ Member function @ Description -a@ -[source] +.[apititle]#call operator# +[source,role=synopsis,id=api:multiplies-call-operator] ---- -T operator()(const T& x, const T& y) const +T operator()(const T& x, const T& y) const; ---- - a@ Returns the bitwise OR of its arguments, equivalent to [code]#x | y#. -|==== +_Returns_: [code]#x * y#. -[[table.function.objects.bit-xor]] -.Member functions for the [code]#bit_xor# function object -[width="100%",options="header",separator="@",cols="65%,35%"] -|==== -@ Member function @ Description -a@ -[source] +''' + +.[apititle]#transparent call operator# +[source,role=synopsis,id=api:multiplies-transparent-call-operator] ---- -T operator()(const T& x, const T& y) const +template constexpr auto operator()(T&& t, U&& u) const + -> decltype(std::forward(t) * std::forward(u)); ---- - a@ Returns the bitwise XOR of its arguments, equivalent to [code]#x ^ y#. -|==== +_Returns_: [code]#std::forward(t) * std::forward(u)#. -[[table.function.objects.logical-and]] -.Member functions for the [code]#logical_and# function object -[width="100%",options="header",separator="@",cols="65%,35%"] -|==== -@ Member function @ Description -a@ -[source] +==== [code]#bit_and# class template + +[source,role=synopsis] ---- -T operator()(const T& x, const T& y) const +include::{header_dir}/functional/bit_and.h[lines=4..-1] ---- - a@ Returns the logical AND of its arguments, equivalent to [code]#x && y#. -|==== +''' -[[table.function.objects.logical-or]] -.Member functions for the [code]#logical_or# function object -[width="100%",options="header",separator="@",cols="65%,35%"] -|==== -@ Member function @ Description -a@ -[source] +.[apititle]#call operator# +[source,role=synopsis,id=api:bit_and-call-operator] ---- -T operator()(const T& x, const T& y) const +T operator()(const T& x, const T& y) const; ---- - a@ Returns the logical OR of its arguments, equivalent to [code]#x || y#. -|==== +_Returns_: [code]#x & y#. -[[table.function.objects.minimum]] -.Member functions for the [code]#minimum# function object -[width="100%",options="header",separator="@",cols="65%,35%"] -|==== -@ Member function @ Description -a@ -[source] +''' + +.[apititle]#transparent call operator# +[source,role=synopsis,id=api:bit_and-transparent-call-operator] ---- -T operator()(const T& x, const T& y) const +template constexpr auto operator()(T&& t, U&& u) const + -> decltype(std::forward(t) & std::forward(u)); ---- - a@ Returns the smaller value. Returns the first argument when the arguments - are equivalent. -|==== +_Returns_: [code]#std::forward(t) & std::forward(u)#. -[[table.function.objects.maximum]] -.Member functions for the [code]#maximum# function object -[width="100%",options="header",separator="@",cols="65%,35%"] -|==== -@ Member function @ Description -a@ -[source] +==== [code]#bit_or# class template + +[source,role=synopsis] ---- -T operator()(const T& x, const T& y) const +include::{header_dir}/functional/bit_or.h[lines=4..-1] ---- - a@ Returns the larger value. Returns the first argument when the arguments - are equivalent. -|==== +''' + +.[apititle]#call operator# +[source,role=synopsis,id=api:bit_or-call-operator] +---- +T operator()(const T& x, const T& y) const; +---- + +_Returns_: [code]#x | y#. + +''' + +.[apititle]#transparent call operator# +[source,role=synopsis,id=api:bit_or-transparent-call-operator] +---- +template constexpr auto operator()(T&& t, U&& u) const + -> decltype(std::forward(t) | std::forward(u)); +---- + +_Returns_: [code]#std::forward(t) | std::forward(u)#. + +==== [code]#bit_xor# class template + +[source,role=synopsis] +---- +include::{header_dir}/functional/bit_xor.h[lines=4..-1] +---- + +''' + +.[apititle]#call operator# +[source,role=synopsis,id=api:bit_xor-call-operator] +---- +T operator()(const T& x, const T& y) const; +---- + +_Returns_: [code]#x ^ y#. + +''' + +.[apititle]#transparent call operator# +[source,role=synopsis,id=api:bit_xor-transparent-call-operator] +---- +template constexpr auto operator()(T&& t, U&& u) const + -> decltype(std::forward(t) ^ std::forward(u)); +---- + +_Returns_: [code]#std::forward(t) ^ std::forward(u)#. + +==== [code]#logical_and# class template + +[source,role=synopsis] +---- +include::{header_dir}/functional/logical_and.h[lines=4..-1] +---- + +''' + +.[apititle]#call operator# +[source,role=synopsis,id=api:logical_and-call-operator] +---- +bool operator()(const T& x, const T& y) const; +---- + +_Returns_: [code]#x && y#. + +''' + +.[apititle]#transparent call operator# +[source,role=synopsis,id=api:logical_and-transparent-call-operator] +---- +template constexpr auto operator()(T&& t, U&& u) const + -> decltype(std::forward(t) && std::forward(u)); +---- + +_Returns_: [code]#std::forward(t) && std::forward(u)#. + +==== [code]#logical_or# class template + +[source,role=synopsis] +---- +include::{header_dir}/functional/logical_or.h[lines=4..-1] +---- + +''' + +.[apititle]#call operator# +[source,role=synopsis,id=api:logical_or-call-operator] +---- +bool operator()(const T& x, const T& y) const; +---- + +_Returns_: [code]#x || y#. + +''' + +.[apititle]#transparent call operator# +[source,role=synopsis,id=api:logical_or-transparent-call-operator] +---- +template constexpr auto operator()(T&& t, U&& u) const + -> decltype(std::forward(t) || std::forward(u)); +---- + +_Returns_: [code]#std::forward(t) || std::forward(u)#. + +==== [code]#minimum# class template + +[source,role=synopsis] +---- +include::{header_dir}/functional/minimum.h[lines=4..-1] +---- + +''' + +.[apititle]#call operator# +[source,role=synopsis,id=api:minimum-call-operator] +---- +T operator()(const T& x, const T& y) const; +---- + +_Returns_: The smaller value, or [code]#x# if the arguments are equivalent. + +''' + +.[apititle]#transparent call operator# +[source,role=synopsis,id=api:minimum-transparent-call-operator] +---- +template constexpr auto operator()(T&& t, U&& u) const + -> /* see below */; +---- + +_Returns_: The smaller value, or [code]#x# if the arguments are equivalent. +The return type is deduced. + +==== [code]#maximum# class template + +[source,role=synopsis] +---- +include::{header_dir}/functional/maximum.h[lines=4..-1] +---- + +''' + +.[apititle]#call operator# +[source,role=synopsis,id=api:maximum-call-operator] +---- +T operator()(const T& x, const T& y) const; +---- + +_Returns_: The larger value, or [code]#x# if the arguments are equivalent. + +''' + +.[apititle]#transparent call operator# +[source,role=synopsis,id=api:maximum-transparent-call-operator] +---- +template constexpr auto operator()(T&& t, U&& u) const + -> /* see below */; +---- + +_Returns_: The larger value, or [code]#x# if the arguments are equivalent. +The return type is deduced. + [[sec:group-functions]] === Group functions diff --git a/adoc/headers/functional.h b/adoc/headers/functional.h deleted file mode 100644 index e9a00cff1..000000000 --- a/adoc/headers/functional.h +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) 2011-2024 The Khronos Group, Inc. -// SPDX-License-Identifier: MIT - -namespace sycl { - -template struct plus { - T operator()(const T& x, const T& y) const; -}; - -template struct multiplies { - T operator()(const T& x, const T& y) const; -}; - -template struct bit_and { - T operator()(const T& x, const T& y) const; -}; - -template struct bit_or { - T operator()(const T& x, const T& y) const; -}; - -template struct bit_xor { - T operator()(const T& x, const T& y) const; -}; - -template struct logical_and { - T operator()(const T& x, const T& y) const; -}; - -template struct logical_or { - T operator()(const T& x, const T& y) const; -}; - -template struct minimum { - T operator()(const T& x, const T& y) const; -}; - -template struct maximum { - T operator()(const T& x, const T& y) const; -}; - -} // namespace sycl diff --git a/adoc/headers/functional/bit_and.h b/adoc/headers/functional/bit_and.h new file mode 100644 index 000000000..05c91cf78 --- /dev/null +++ b/adoc/headers/functional/bit_and.h @@ -0,0 +1,17 @@ +// Copyright (c) 2011-2024 The Khronos Group, Inc. +// SPDX-License-Identifier: MIT + +namespace sycl { + +template struct bit_and { + T operator()(const T& x, const T& y) const; +}; + +template <> struct bit_and { + template constexpr auto operator()(T&& t, U&& u) const + -> decltype(std::forward(t) & std::forward(u)); + + using is_transparent = /* unspecified */; +}; + +} // namespace sycl diff --git a/adoc/headers/functional/bit_or.h b/adoc/headers/functional/bit_or.h new file mode 100644 index 000000000..356f1cf8b --- /dev/null +++ b/adoc/headers/functional/bit_or.h @@ -0,0 +1,17 @@ +// Copyright (c) 2011-2024 The Khronos Group, Inc. +// SPDX-License-Identifier: MIT + +namespace sycl { + +template struct bit_or { + T operator()(const T& x, const T& y) const; +}; + +template <> struct bit_or { + template constexpr auto operator()(T&& t, U&& u) const + -> decltype(std::forward(t) | std::forward(u)); + + using is_transparent = /* unspecified */; +}; + +} // namespace sycl diff --git a/adoc/headers/functional/bit_xor.h b/adoc/headers/functional/bit_xor.h new file mode 100644 index 000000000..3b10513f0 --- /dev/null +++ b/adoc/headers/functional/bit_xor.h @@ -0,0 +1,17 @@ +// Copyright (c) 2011-2024 The Khronos Group, Inc. +// SPDX-License-Identifier: MIT + +namespace sycl { + +template struct bit_xor { + T operator()(const T& x, const T& y) const; +}; + +template <> struct bit_xor { + template constexpr auto operator()(T&& t, U&& u) const + -> decltype(std::forward(t) ^ std::forward(u)); + + using is_transparent = /* unspecified */; +}; + +} // namespace sycl diff --git a/adoc/headers/functional/logical_and.h b/adoc/headers/functional/logical_and.h new file mode 100644 index 000000000..e081dc263 --- /dev/null +++ b/adoc/headers/functional/logical_and.h @@ -0,0 +1,17 @@ +// Copyright (c) 2011-2024 The Khronos Group, Inc. +// SPDX-License-Identifier: MIT + +namespace sycl { + +template struct logical_and { + bool operator()(const T& x, const T& y) const; +}; + +template <> struct logical_and { + template constexpr auto operator()(T&& t, U&& u) const + -> decltype(std::forward(t) && std::forward(u)); + + using is_transparent = /* unspecified */; +}; + +} // namespace sycl diff --git a/adoc/headers/functional/logical_or.h b/adoc/headers/functional/logical_or.h new file mode 100644 index 000000000..beaf8516d --- /dev/null +++ b/adoc/headers/functional/logical_or.h @@ -0,0 +1,17 @@ +// Copyright (c) 2011-2024 The Khronos Group, Inc. +// SPDX-License-Identifier: MIT + +namespace sycl { + +template struct logical_or { + bool operator()(const T& x, const T& y) const; +}; + +template <> struct logical_or { + template constexpr auto operator()(T&& t, U&& u) const + -> decltype(std::forward(t) || std::forward(u)); + + using is_transparent = /* unspecified */; +}; + +} // namespace sycl diff --git a/adoc/headers/functional/maximum.h b/adoc/headers/functional/maximum.h new file mode 100644 index 000000000..e91efcb74 --- /dev/null +++ b/adoc/headers/functional/maximum.h @@ -0,0 +1,17 @@ +// Copyright (c) 2011-2024 The Khronos Group, Inc. +// SPDX-License-Identifier: MIT + +namespace sycl { + +template struct maximum { + T operator()(const T& x, const T& y) const; +}; + +template <> struct maximum { + template constexpr auto operator()(T&& t, U&& u) const + -> /* see below */; + + using is_transparent = /* unspecified */; +}; + +} // namespace sycl diff --git a/adoc/headers/functional/minimum.h b/adoc/headers/functional/minimum.h new file mode 100644 index 000000000..15ef8bfbc --- /dev/null +++ b/adoc/headers/functional/minimum.h @@ -0,0 +1,17 @@ +// Copyright (c) 2011-2024 The Khronos Group, Inc. +// SPDX-License-Identifier: MIT + +namespace sycl { + +template struct minimum { + T operator()(const T& x, const T& y) const; +}; + +template <> struct minimum { + template constexpr auto operator()(T&& t, U&& u) const + -> /* see below */; + + using is_transparent = /* unspecified */; +}; + +} // namespace sycl diff --git a/adoc/headers/functional/multiplies.h b/adoc/headers/functional/multiplies.h new file mode 100644 index 000000000..741ebb16e --- /dev/null +++ b/adoc/headers/functional/multiplies.h @@ -0,0 +1,17 @@ +// Copyright (c) 2011-2024 The Khronos Group, Inc. +// SPDX-License-Identifier: MIT + +namespace sycl { + +template struct multiplies { + T operator()(const T& x, const T& y) const; +}; + +template <> struct multiplies { + template constexpr auto operator()(T&& t, U&& u) const + -> decltype(std::forward(t) * std::forward(u)); + + using is_transparent = /* unspecified */; +}; + +} // namespace sycl diff --git a/adoc/headers/functional/plus.h b/adoc/headers/functional/plus.h new file mode 100644 index 000000000..70a1f637f --- /dev/null +++ b/adoc/headers/functional/plus.h @@ -0,0 +1,17 @@ +// Copyright (c) 2011-2024 The Khronos Group, Inc. +// SPDX-License-Identifier: MIT + +namespace sycl { + +template struct plus { + T operator()(const T& x, const T& y) const; +}; + +template <> struct plus { + template constexpr auto operator()(T&& t, U&& u) const + -> decltype(std::forward(t) + std::forward(u)); + + using is_transparent = /* unspecified */; +}; + +} // namespace sycl From f4eb1a82d30f4a7e7f2a76e71cf433951c872784 Mon Sep 17 00:00:00 2001 From: John Pennycook Date: Thu, 24 Oct 2024 14:07:04 +0100 Subject: [PATCH 2/5] Satisfy reflow --- adoc/chapters/programming_interface.adoc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/adoc/chapters/programming_interface.adoc b/adoc/chapters/programming_interface.adoc index 53ebf09f1..03a1e71ee 100644 --- a/adoc/chapters/programming_interface.adoc +++ b/adoc/chapters/programming_interface.adoc @@ -21305,7 +21305,8 @@ template constexpr auto operator()(T&& t, U&& u) const ---- // Strange formatting here because + requires pass, but pass breaks /. -_Returns_: [code]#std::forward(t)# [code]#pass:[+]# [code]#std::forward(u)#. +_Returns_: [code]#std::forward(t)# [code]#pass:[+]# +[code]#std::forward(u)#. ==== [code]#multiplies# class template From 5ae4b132599902b5de3d4f6f25cf6405d5d41a18 Mon Sep 17 00:00:00 2001 From: John Pennycook Date: Fri, 25 Oct 2024 09:07:15 +0100 Subject: [PATCH 3/5] Fix copy-paste error in transparent operators x -> t --- adoc/chapters/programming_interface.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adoc/chapters/programming_interface.adoc b/adoc/chapters/programming_interface.adoc index 03a1e71ee..2339d3273 100644 --- a/adoc/chapters/programming_interface.adoc +++ b/adoc/chapters/programming_interface.adoc @@ -21502,7 +21502,7 @@ template constexpr auto operator()(T&& t, U&& u) const -> /* see below */; ---- -_Returns_: The smaller value, or [code]#x# if the arguments are equivalent. +_Returns_: The smaller value, or [code]#t# if the arguments are equivalent. The return type is deduced. ==== [code]#maximum# class template @@ -21531,7 +21531,7 @@ template constexpr auto operator()(T&& t, U&& u) const -> /* see below */; ---- -_Returns_: The larger value, or [code]#x# if the arguments are equivalent. +_Returns_: The larger value, or [code]#t# if the arguments are equivalent. The return type is deduced. From 0308265f8462d4353959f49ff9ba1f37a3b59b48 Mon Sep 17 00:00:00 2001 From: John Pennycook Date: Fri, 25 Oct 2024 09:17:24 +0100 Subject: [PATCH 4/5] Define minimum/maximum return type using a ternary Note that the decltype() only describes the return type of the operator, so it doesn't actually constrain the implementation of the operator. --- adoc/chapters/programming_interface.adoc | 4 ++-- adoc/headers/functional/maximum.h | 2 +- adoc/headers/functional/minimum.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/adoc/chapters/programming_interface.adoc b/adoc/chapters/programming_interface.adoc index 2339d3273..a4ab32c47 100644 --- a/adoc/chapters/programming_interface.adoc +++ b/adoc/chapters/programming_interface.adoc @@ -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 constexpr auto operator()(T&& t, U&& u) const - -> /* see below */; +-> decltype(std::forward(u) < std::forward(t) ? std::forward(u) : std::forward(t)); ---- _Returns_: The smaller value, or [code]#t# if the arguments are equivalent. @@ -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 constexpr auto operator()(T&& t, U&& u) const - -> /* see below */; +-> decltype(std::forward(t) < std::forward(u) ? std::forward(u) : std::forward(t)); ---- _Returns_: The larger value, or [code]#t# if the arguments are equivalent. diff --git a/adoc/headers/functional/maximum.h b/adoc/headers/functional/maximum.h index e91efcb74..65a565454 100644 --- a/adoc/headers/functional/maximum.h +++ b/adoc/headers/functional/maximum.h @@ -9,7 +9,7 @@ template struct maximum { template <> struct maximum { template constexpr auto operator()(T&& t, U&& u) const - -> /* see below */; + -> decltype(std::forward(t) < std::forward(u) ? std::forward(u) : std::forward(t)); using is_transparent = /* unspecified */; }; diff --git a/adoc/headers/functional/minimum.h b/adoc/headers/functional/minimum.h index 15ef8bfbc..d71b782f7 100644 --- a/adoc/headers/functional/minimum.h +++ b/adoc/headers/functional/minimum.h @@ -9,7 +9,7 @@ template struct minimum { template <> struct minimum { template constexpr auto operator()(T&& t, U&& u) const - -> /* see below */; + -> decltype(std::forward(u) < std::forward(t) ? std::forward(u) : std::forward(t)); using is_transparent = /* unspecified */; }; From e3d879f3286d633bd777cbd6bb6f39fc1e500a1d Mon Sep 17 00:00:00 2001 From: John Pennycook Date: Fri, 25 Oct 2024 09:29:56 +0100 Subject: [PATCH 5/5] Align minimum/maximum description with min/max - Add Precondition that T is Cpp17LessThanComparable. - Use the same wording for the Returns paragraph. --- adoc/chapters/programming_interface.adoc | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/adoc/chapters/programming_interface.adoc b/adoc/chapters/programming_interface.adoc index a4ab32c47..79216b301 100644 --- a/adoc/chapters/programming_interface.adoc +++ b/adoc/chapters/programming_interface.adoc @@ -21491,7 +21491,10 @@ include::{header_dir}/functional/minimum.h[lines=4..-1] T operator()(const T& x, const T& y) const; ---- -_Returns_: The smaller value, or [code]#x# if the arguments are equivalent. +_Preconditions_: [code]#T# meets the Cpp17LessThanComparable requirements. + +_Returns_: The smaller value. +Returns the first value when the arguments are equivalent. ''' @@ -21502,8 +21505,10 @@ template constexpr auto operator()(T&& t, U&& u) const -> decltype(std::forward(u) < std::forward(t) ? std::forward(u) : std::forward(t)); ---- -_Returns_: The smaller value, or [code]#t# if the arguments are equivalent. -The return type is deduced. +_Preconditions_: [code]#T# meets the Cpp17LessThanComparable requirements. + +_Returns_: The smaller value. +Returns the first value when the arguments are equivalent. ==== [code]#maximum# class template @@ -21520,7 +21525,10 @@ include::{header_dir}/functional/maximum.h[lines=4..-1] T operator()(const T& x, const T& y) const; ---- -_Returns_: The larger value, or [code]#x# if the arguments are equivalent. +_Preconditions_: [code]#T# meets the Cpp17LessThanComparable requirements. + +_Returns_: The larger value. +Returns the first value when the arguments are equivalent. ''' @@ -21531,8 +21539,10 @@ template constexpr auto operator()(T&& t, U&& u) const -> decltype(std::forward(t) < std::forward(u) ? std::forward(u) : std::forward(t)); ---- -_Returns_: The larger value, or [code]#t# if the arguments are equivalent. -The return type is deduced. +_Preconditions_: [code]#T# meets the Cpp17LessThanComparable requirements. + +_Returns_: The larger value. +Returns the first value when the arguments are equivalent. [[sec:group-functions]]