[#mp_units-get_common_unit-08f] = xref:mp_units.adoc[mp_units]::get_common_unit :relfileprefix: ../ :mrdocs: `get_common_unit` overloads == Synopses Declared in `<mp‐units/framework/reference.h>` Returns the common unit of a single unit [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- [[nodiscard]] consteval xref:mp_units/Unit.adoc[Unit] auto xref:mp_units/get_common_unit-0e.adoc[get_common_unit](auto u); ---- [.small]#xref:mp_units/get_common_unit-0e.adoc[_» more..._]# Computes the common unit of a single new unit and a `common_unit` compound [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< xref:mp_units/Unit.adoc[Unit]... Us, /* implementation-defined */ NewUnit> [[nodiscard]] consteval xref:mp_units/Unit.adoc[Unit] auto xref:mp_units/get_common_unit-08c.adoc[get_common_unit]( NewUnit nu, xref:mp_units/common_unit.adoc[common_unit<Us...>] cu); ---- [.small]#xref:mp_units/get_common_unit-08c.adoc[_» more..._]# Computes the common unit of two convertible units [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< xref:mp_units/Unit.adoc[Unit] U1, /* implementation-defined */ U2> [[nodiscard]] consteval xref:mp_units/Unit.adoc[Unit] auto xref:mp_units/get_common_unit-0d.adoc[get_common_unit]( U1 u1, U2 u2); ---- [.small]#xref:mp_units/get_common_unit-0d.adoc[_» more..._]# Computes the common unit of a `common_unit` compound and a single new unit [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< xref:mp_units/Unit.adoc[Unit]... Us, /* implementation-defined */ NewUnit> [[nodiscard]] consteval xref:mp_units/Unit.adoc[Unit] auto xref:mp_units/get_common_unit-08d.adoc[get_common_unit]( xref:mp_units/common_unit.adoc[common_unit<Us...>] cu, NewUnit new_unit); ---- [.small]#xref:mp_units/get_common_unit-08d.adoc[_» more..._]# Computes the common unit of two `common_unit` compounds by merging their unit lists [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< xref:mp_units/Unit.adoc[Unit] Front, xref:mp_units/Unit.adoc[Unit]... Rest, xref:mp_units/Unit.adoc[Unit]... Us> requires (detail::UnitConvertibleTo<common_unit<Front, Rest...>, common_unit<Us...>{}>) [[nodiscard]] consteval xref:mp_units/Unit.adoc[Unit] auto xref:mp_units/get_common_unit-09.adoc[get_common_unit]( xref:mp_units/common_unit.adoc[common_unit<Front, Rest...>] cu1, xref:mp_units/common_unit.adoc[common_unit<Us...>] cu2); ---- [.small]#xref:mp_units/get_common_unit-09.adoc[_» more..._]# Computes the common unit of three or more units [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- [[nodiscard]] consteval xref:mp_units/Unit.adoc[Unit] auto xref:mp_units/get_common_unit-02.adoc[get_common_unit]( auto u1, auto u2, auto u3, auto... rest) requires requires { mp_units::get_common_unit(mp_units::get_common_unit(u1, u2), u3, rest...); }; ---- [.small]#xref:mp_units/get_common_unit-02.adoc[_» more..._]# == Return Value * `u` unchanged * the common unit obtained by merging `nu` into `cu's` unit list * the common unit of `u1` and `u2` * the common unit obtained by merging the new unit into the compound's unit list * the common unit obtained by merging the unit lists of `cu1` and `cu2` * the common unit obtained by folding `get_common_unit` over `u1,` `u2,` `u3,` and `rest` [NOTE] ==== The return value https://en.cppreference.com/cpp/language/attributes/nodiscard[should not be discarded^]. ==== == Parameters [cols="1,4"] |=== | Name| Description | *u* | the unit | *nu* | the single unit | *cu* | the `common_unit` compound | *u1* | first unit | *u2* | second unit | *new_unit* | the new unit to merge into the compound's unit list | *cu1* | first `common_unit` compound | *cu2* | second `common_unit` compound | *u3* | third unit | *rest* | remaining units, if any |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#