Skip to content

Commit

Permalink
[qty.common.type] Inline *require-clause*s
Browse files Browse the repository at this point in the history
  • Loading branch information
JohelEGP committed Oct 29, 2024
1 parent 0de0ba8 commit fbd3369
Showing 1 changed file with 6 additions and 18 deletions.
24 changes: 6 additions & 18 deletions docs/api_reference/src/quantities.tex
Original file line number Diff line number Diff line change
Expand Up @@ -3885,36 +3885,24 @@
\indexlibraryglobal{std::common_type}
\begin{codeblock}
template<mp_units::@\libconcept{Quantity}@ Q1, mp_units::@\libconcept{Quantity}@ Q2>
requires @\seebelownc@
requires requires {
{ mp_units::get_common_reference(Q1::reference, Q2::reference) } -> mp_units::Reference;
typename std::common_type_t<typename Q1::rep, typename Q2::rep>;
}
struct std::common_type<Q1, Q2> {
using type = mp_units::quantity<mp_units::get_common_reference(Q1::reference, Q2::reference),
std::common_type_t<typename Q1::rep, typename Q2::rep>>;
};
template<mp_units::@\libconcept{Quantity}@ Q,
mp_units::@\libconcept{RepresentationOf}@<mp_units::quantity_character::scalar> Value>
requires @\seebelownc@
requires(Q::unit == mp_units::one) &&
requires { typename std::common_type_t<typename Q::rep, Value>; }
struct std::common_type<Q, Value> {
using type = mp_units::quantity<Q::reference, std::common_type_t<typename Q::rep, Value>>;
};
\end{codeblock}
\pnum
\remarks
For the first specialization,
the expression in the \fakegrammarterm{requires-clause} is equivalent to:
\begin{codeblock}
requires {
{ mp_units::get_common_reference(Q1::reference, Q2::reference) } -> mp_units::@\libconcept{Reference}@;
typename std::common_type_t<typename Q1::rep, typename Q2::rep>;
}
\end{codeblock}
For the second specialization,
the expression in the \fakegrammarterm{requires-clause} is equivalent to:
\begin{codeblock}
(Q::unit == mp_units::one) && requires { typename std::common_type_t<typename Q::rep, Value>; }
\end{codeblock}
\rSec2[qty.pt.concepts]{Quantity point concepts}
\begin{itemdecl}
Expand Down

0 comments on commit fbd3369

Please sign in to comment.