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

The additive identity of T. More...

Static Public Attributes

static constexpr T value {}
 The additive identity value.
 

Detailed Description

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

The additive identity of T.

Template Parameters
Tnumeric type

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

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

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

Because zero_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 zero_v for that type is ill-formed.

template <>
struct arene::base::numbers::zero<my_type> {
static constexpr my_type value{};
};
// Required for ODR use: zero_v<my_type> binds a reference to this member.
The additive identity of T.
Definition arithmetic_identities.hpp:42
static constexpr T value
The additive identity value.
Definition arithmetic_identities.hpp:44

Member Data Documentation

◆ value

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

The additive identity value.


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