Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
arene::base::numbers::one< T > Struct Template Reference

The multiplicative identity of T. More...

Static Public Attributes

static constexpr T value {1}
 The multiplicative identity value.
 

Detailed Description

template<typename T>
struct arene::base::numbers::one< T >

The multiplicative identity of T.

Template Parameters
Tnumeric type

Provides access to the multiplicative identity of T through its static member value . This value is the multiplicative identity; a * one<T>::value == a and one<T>::value * a == a are true for valid values of a of type T .

Users may specialize one for cv-unqualified program-defined types. Such specializations shall have a static member value with type T whose value is the multiplicative identity of T . A specialization is required if any of the following cases are true for the expression T{1} :

  • is not well formed
  • does not match the required semantics
  • is not invocable within a constant expression

Because one_v binds a reference to value , every specialization must also provide a namespace-scope definition of value (a separate out-of-line definition, as required for ODR use in C++14); otherwise naming one_v for that type is ill-formed.

template <>
struct arene::base::numbers::one<my_type> {
static constexpr my_type value{1};
};
// Required for ODR use: one_v<my_type> binds a reference to this member.
The multiplicative identity of T.
Definition arithmetic_identities.hpp:87
static constexpr T value
The multiplicative identity value.
Definition arithmetic_identities.hpp:90

Member Data Documentation

◆ value

template<typename T>
T arene::base::numbers::one< T >::value {1}
staticconstexpr

The multiplicative identity value.


The documentation for this struct was generated from the following file: