micro-test-plus
5.0.1
µTest++ Testing Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
type-traits-inlines.h
Go to the documentation of this file.
1
/*
2
* This file is part of the µOS++ project (https://micro-os-plus.github.io/).
3
* Copyright (c) 2021-2026 Liviu Ionescu. All rights reserved.
4
*
5
* Permission to use, copy, modify, and/or distribute this software for any
6
* purpose is hereby granted, under the terms of the MIT license.
7
*
8
* If a copy of the license was not distributed with this file, it can be
9
* obtained from https://opensource.org/licenses/mit.
10
*
11
* Major parts of the code are inspired from v1.1.8 of the Boost UT project,
12
* released under the terms of the Boost Version 1.0 Software License,
13
* which can be obtained from https://www.boost.org/LICENSE_1_0.txt.
14
*/
15
16
// ----------------------------------------------------------------------------
17
42
43
#ifndef MICRO_OS_PLUS_MICRO_TEST_PLUS_INLINES_TYPE_TRAITS_INLINES_H_
44
#define MICRO_OS_PLUS_MICRO_TEST_PLUS_INLINES_TYPE_TRAITS_INLINES_H_
45
46
// ----------------------------------------------------------------------------
47
48
#if defined(__cplusplus)
49
50
// ----------------------------------------------------------------------------
51
52
#if defined(__GNUC__)
53
#pragma GCC diagnostic push
54
55
#if defined(__clang__)
56
#pragma clang diagnostic ignored "-Wc++98-compat"
57
#pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
58
#endif
// defined(__clang__)
59
#endif
// defined(__GNUC__)
60
61
// ============================================================================
62
63
namespace
micro_os_plus::micro_test_plus
64
{
65
namespace
type_traits
66
{
67
// ========================================================================
68
73
template
<
class
T>
74
constexpr
value_base_<T>::value_base_
(
const
T& v) noexcept :
value_
{ v }
75
{
76
}
77
82
template
<
class
T>
83
constexpr
value_base_<T>
::
84
operator T () const noexcept
85
{
86
return
value_
;
87
}
88
93
template
<
class
T>
94
constexpr
T
95
value_base_<T>::get
(
void
)
const
noexcept
96
{
97
return
value_
;
98
}
99
100
// ------------------------------------------------------------------------
101
106
template
<auto N>
107
constexpr
integral_constant<N>::integral_constant
() noexcept
108
:
value_base_
<decltype (N)>{ N }
109
{
110
}
111
117
template
<auto N>
118
constexpr
auto
119
integral_constant<N>::operator-
() const noexcept
120
{
121
return
integral_constant
<-N>{};
122
}
123
124
// ------------------------------------------------------------------------
125
130
template
<
class
T, auto N, auto D, auto Size, auto P>
131
constexpr
floating_point_constant<T, N, D, Size, P>
::
132
operator T () const noexcept
133
{
134
return
value
;
135
}
136
141
template
<
class
T, auto N, auto D, auto Size, auto P>
142
constexpr
T
143
floating_point_constant<T, N, D, Size, P>::get
(
void
)
const
noexcept
144
{
145
return
value
;
146
}
147
153
template
<
class
T, auto N, auto D, auto Size, auto P>
154
constexpr
auto
155
floating_point_constant<T, N, D, Size, P>::operator-
() const noexcept
156
{
157
return
floating_point_constant
<T, N, D, Size, -P>{};
158
}
159
160
// ------------------------------------------------------------------------
161
166
template
<
class
T>
167
constexpr
genuine_integral_value<T>::genuine_integral_value
(
168
const
T& _value) noexcept
169
:
value_base_<T>
{ _value }
170
{
171
}
172
173
// ------------------------------------------------------------------------
174
175
template
<
class
T>
176
constexpr
value<T>::value
(
const
T& _value) noexcept
177
: value_base_<T>{ _value }
178
{
179
}
180
181
// ------------------------------------------------------------------------
182
}
// namespace type_traits
183
184
// --------------------------------------------------------------------------
185
}
// namespace micro_os_plus::micro_test_plus
186
187
#if defined(__GNUC__)
188
#pragma GCC diagnostic pop
189
#endif
// defined(__GNUC__)
190
191
// ----------------------------------------------------------------------------
192
193
#endif
// defined(__cplusplus)
194
195
// ----------------------------------------------------------------------------
196
197
#endif
// MICRO_OS_PLUS_MICRO_TEST_PLUS_INLINES_TYPE_TRAITS_INLINES_H_
198
199
// ----------------------------------------------------------------------------
micro_os_plus::micro_test_plus::type_traits
Type trait utilities and metaprogramming support for the µTest++ testing framework.
Definition
type-traits-inlines.h:66
micro_os_plus::micro_test_plus
Primary namespace for the µTest++ testing framework.
Definition
deferred-reporter.h:82
micro_os_plus::micro_test_plus::type_traits::floating_point_constant
Struct template representing a generic floating point constant with custom size and precision.
Definition
type-traits.h:626
micro_os_plus::micro_test_plus::type_traits::floating_point_constant::operator-
constexpr auto operator-() const noexcept
Unary minus operator.
Definition
type-traits-inlines.h:155
micro_os_plus::micro_test_plus::type_traits::floating_point_constant::get
constexpr T get(void) const noexcept
Getter for the compile-time constant value.
Definition
type-traits-inlines.h:143
micro_os_plus::micro_test_plus::type_traits::floating_point_constant::value
static constexpr auto value
The compile-time constant value.
Definition
type-traits.h:650
micro_os_plus::micro_test_plus::type_traits::genuine_integral_value::genuine_integral_value
constexpr genuine_integral_value(const T &_value) noexcept
Constructs a genuine_integral_value with the specified value.
Definition
type-traits-inlines.h:167
micro_os_plus::micro_test_plus::type_traits::integral_constant::integral_constant
constexpr integral_constant() noexcept
Default constructor. Initialises the base with N.
Definition
type-traits-inlines.h:107
micro_os_plus::micro_test_plus::type_traits::integral_constant::operator-
constexpr auto operator-() const noexcept
Unary minus operator.
Definition
type-traits-inlines.h:119
micro_os_plus::micro_test_plus::type_traits::value_base_::value_
T value_
The stored value.
Definition
type-traits.h:553
micro_os_plus::micro_test_plus::type_traits::value_base_::value_base_
constexpr value_base_(const T &v) noexcept
Constructs a value_base_ with the given value.
Definition
type-traits-inlines.h:74
micro_os_plus::micro_test_plus::type_traits::value_base_::get
constexpr T get(void) const noexcept
Getter for the stored value.
Definition
type-traits-inlines.h:95
micro_os_plus::micro_test_plus::type_traits::value::value
constexpr value(const T &_value) noexcept
Constructs a value object with the specified value.
include
micro-os-plus
micro-test-plus
inlines
type-traits-inlines.h
Generated by
1.17.0