tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
is_empty.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2
3#ifndef TETL_TYPE_TRAITS_IS_EMPTY_HPP
4#define TETL_TYPE_TRAITS_IS_EMPTY_HPP
5
9
10namespace etl {
11
12namespace detail {
13
14template <typename T>
15struct is_empty_tester_1 : etl::remove_cv_t<T> {
16 char dummy_data;
17};
18
19struct is_empty_tester_2 {
20 char dummy_data;
21};
22
23template <typename T>
24struct is_empty : false_type { };
25
26template <typename T>
27 requires is_class_v<T>
28struct is_empty<T> : bool_constant<sizeof(is_empty_tester_1<T>) == sizeof(is_empty_tester_2)> { };
29
30} // namespace detail
31
36template <typename T>
37struct is_empty : detail::is_empty<T> { };
38
39template <typename T>
40inline constexpr bool is_empty_v = is_empty<T>::value;
41
42} // namespace etl
43
44#endif // TETL_TYPE_TRAITS_IS_EMPTY_HPP
Definition adjacent_find.hpp:8
remove_const_t< remove_volatile_t< T > > remove_cv_t
Definition remove_cv.hpp:22
constexpr bool is_empty_v
Definition is_empty.hpp:40
integral_constant< bool, B > bool_constant
Definition bool_constant.hpp:11
constexpr bool is_class_v
Definition is_class.hpp:16
bool_constant< false > false_type
Definition bool_constant.hpp:14
static constexpr bool value
Definition integral_constant.hpp:10
f T is an empty type (that is, a non-union class type with no non-static data members other than bit-...
Definition is_empty.hpp:37