Skip to content

mp_units::unit_symbol_solidus

Selects when a unit symbol divides with a solidus and when it uses negative exponents

Synopsis

Declared in <mp-units/framework/unit_symbol_formatting.h>

enum class unit_symbol_solidus : int;

Description

The default writes a solidus only for a single unit in the denominator. A publication that asks for negative exponents throughout selects never:

constexpr std::string_view text_unit = unit_symbol(m / s);  // "m/s"
constexpr std::string_view paper_unit =
  unit_symbol<{.solidus = unit_symbol_solidus::never}>(m / s);  // "m s⁻¹"

The 1, a, and n tokens of a format specification select one_denominator, always, and never.

Members

NameDescription
one_denominator A solidus for a single unit in the denominator, as in m/s, negative exponents otherwise, as in kg m⁻¹ s⁻¹
always Always a solidus, as in m/s and kg/(m s)
never Never a solidus, as in m s⁻¹ and kg m⁻¹ s⁻¹
default_solidus [deprecated]The former default, one_denominator

See Also