get_common_unit overloads

Synopses

Declared in <mp‐units/framework/reference.h>

Returns the common unit of a single unit

[[nodiscard]]
consteval
Unit auto
get_common_unit(auto u);

Computes the common unit of a single new unit and a common_unit compound

template<
    Unit... Us,
    /* implementation-defined */ NewUnit>
[[nodiscard]]
consteval
Unit auto
get_common_unit(
    NewUnit nu,
    common_unit<Us...> cu);

Computes the common unit of two convertible units

template<
    Unit U1,
    /* implementation-defined */ U2>
[[nodiscard]]
consteval
Unit auto
get_common_unit(
    U1 u1,
    U2 u2);

Computes the common unit of a common_unit compound and a single new unit

template<
    Unit... Us,
    /* implementation-defined */ NewUnit>
[[nodiscard]]
consteval
Unit auto
get_common_unit(
    common_unit<Us...> cu,
    NewUnit new_unit);

Computes the common unit of two common_unit compounds by merging their unit lists

template<
    Unit Front,
    Unit... Rest,
    Unit... Us>
requires (detail::UnitConvertibleTo<common_unit<Front, Rest...>, common_unit<Us...>{}>)
[[nodiscard]]
consteval
Unit auto
get_common_unit(
    common_unit<Front, Rest...> cu1,
    common_unit<Us...> cu2);

Computes the common unit of three or more units

[[nodiscard]]
consteval
Unit auto
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...); };

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 should not be discarded.

Parameters

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

Created with MrDocs