Skip to main content

integral_constant Struct Template

Struct template representing a generic integral constant. More...

Declaration

template <auto N>
struct micro_os_plus::micro_test_plus::type_traits::integral_constant<N> { ... }

Included Headers

Base struct

structvalue_base_<T>

Base struct template providing common storage and accessors for runtime value-wrapper types. More...

Public Member Typedefs Index

template <auto N>
usingvalue_type = decltype(N)

The type of the stored value. More...

Public Constructors Index

template <auto N>
constexprintegral_constant () noexcept

Default constructor. Initialises the base with N. More...

Public Operators Index

template <auto N>
constexproperator decltype(N) () const noexcept

Explicit conversion operator to the underlying value type. More...

template <auto N>
constexpr autooperator- () const noexcept

Unary minus operator. More...

Public Member Functions Index

template <auto N>
constexpr auto get (void) const noexcept -> decltype(N)

Getter for the stored value. More...

Public Member Attributes Index

template <auto N>
decltype(N)value_

The stored value. More...

Public Static Attributes Index

template <auto N>
static constexpr autovalue = N

The compile-time constant value. More...

Description

Struct template representing a generic integral constant.

Template Parameters
N

The compile-time constant value.

The integral_constant struct template provides a compile-time constant value of an integral type, with additional utility features. It inherits from value_base_<decltype(N)>, which supplies the value_type alias, the value_ runtime member, the explicit conversion operator, and the get() accessor.

This struct retains the compile-time value constant and provides a unary minus operator to obtain the negative value as a new integral_constant instance.

Definition at line 575 of file type-traits.h.

Public Member Typedefs

value_type

template <auto N>
using micro_os_plus::micro_test_plus::type_traits::value_base_< decltype(N) >::value_type =

The type of the stored value.

Definition at line 523 of file type-traits.h.

523 using value_type = T;

Public Constructors

integral_constant()

template <auto N>
micro_os_plus::micro_test_plus::type_traits::integral_constant< N >::integral_constant ()
constexpr noexcept

Default constructor. Initialises the base with N.

Delegates to value_base_<decltype(N)>{ N } to initialise the base.

Declaration at line 585 of file type-traits.h, definition at line 107 of file type-traits-inlines.h.

108 : value_base_<decltype (N)>{ N }
109 {
110 }

Reference micro_os_plus::micro_test_plus::type_traits::value_base_< decltype(N)>::value_base_.

Referenced by micro_os_plus::micro_test_plus::type_traits::integral_constant< N >::operator-.

Public Operators

operator decltype(N)()

template <auto N>
micro_os_plus::micro_test_plus::type_traits::value_base_< decltype(N) >::operator decltype(N) ()
explicit nodiscard constexpr noexcept

Explicit conversion operator to the underlying value type.

Returns

The stored value as type T.

Allows explicit conversion to the encapsulated value.

Declaration at line 538 of file type-traits.h, definition at line 84 of file type-traits-inlines.h.

84 operator T () const noexcept
85 {
86 return value_;
87 }

operator-()

template <auto N>
auto micro_os_plus::micro_test_plus::type_traits::integral_constant< N >::operator- ()
nodiscard constexpr noexcept

Unary minus operator.

Returns

An integral_constant with value -N.

Returns a new integral_constant instance representing the negative of the current value.

Declaration at line 593 of file type-traits.h, definition at line 119 of file type-traits-inlines.h.

120 {
121 return integral_constant<-N>{};
122 }

Reference micro_os_plus::micro_test_plus::type_traits::integral_constant< N >::integral_constant.

Public Member Functions

get()

template <auto N>
decltype(N) micro_os_plus::micro_test_plus::type_traits::value_base_< decltype(N) >::get (void)
nodiscard constexpr noexcept

Getter for the stored value.

Parameters

None.

Returns

The stored value.

Returns the stored value by value.

Declaration at line 548 of file type-traits.h, definition at line 95 of file type-traits-inlines.h.

95 value_base_<T>::get (void) const noexcept
96 {
97 return value_;
98 }

Public Member Attributes

value_

template <auto N>
decltype(N) micro_os_plus::micro_test_plus::type_traits::value_base_< decltype(N) >::value_

The stored value.

Definition at line 553 of file type-traits.h.

553 T value_{};

Public Static Attributes

value

template <auto N>
auto micro_os_plus::micro_test_plus::type_traits::integral_constant< N >::value = N
constexpr static

The compile-time constant value.

Definition at line 580 of file type-traits.h.

580 static constexpr auto value = N;

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


Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.17.0.