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 566 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 514 of file type-traits.h.

514 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 576 of file type-traits.h, definition at line 106 of file type-traits-inlines.h.

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

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 529 of file type-traits.h, definition at line 83 of file type-traits-inlines.h.

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

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 584 of file type-traits.h, definition at line 118 of file type-traits-inlines.h.

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

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 539 of file type-traits.h, definition at line 94 of file type-traits-inlines.h.

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

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 544 of file type-traits.h.

544 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 571 of file type-traits.h.

571 static constexpr auto value = N;

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


Generated via doxygen2docusaurus 2.2.0 by Doxygen 1.17.0.