tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
has_unique_object_representations.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2// SPDX-FileCopyrightText: Copyright (C) 2019 Tobias Hienzsch
3
4#ifndef TETL_TYPE_TRAITS_HAS_UNIQUE_OBJECT_REPRESENTATION_HPP
5#define TETL_TYPE_TRAITS_HAS_UNIQUE_OBJECT_REPRESENTATION_HPP
6
7#include <etl/_config/all.hpp>
8
9#include <etl/_type_traits/bool_constant.hpp>
10#include <etl/_type_traits/remove_all_extents.hpp>
11#include <etl/_type_traits/remove_cv.hpp>
12
13namespace etl {
14
15/// \brief If T is TriviallyCopyable and if any two objects of type T with the
16/// same value have the same object representation, provides the member constant
17/// value equal true. For any other type, value is false.
18///
19/// \details For the purpose of this trait, two arrays have the same value if
20/// their elements have the same values, two non-union classes have the same
21/// value if their direct subobjects have the same value, and two unions have
22/// the same value if they have the same active member and the value of that
23/// member is the same. It is implementation-defined which scalar types satisfy
24/// this trait, but unsigned (until C++20) integer types that do not use padding
25/// bits are guaranteed to have unique object representations. The behavior is
26/// undefined if T is an incomplete type other than (possibly cv-qualified) void
27/// or array of unknown bound. The behavior of a program that adds
28/// specializations for has_unique_object_representations or
29/// has_unique_object_representations_v is undefined.
30template <typename T>
32 : bool_constant<__has_unique_object_representations(remove_cv_t<remove_all_extents_t<T>>)> { };
33
34template <typename T>
36
37} // namespace etl
38
39#endif // TETL_TYPE_TRAITS_HAS_UNIQUE_OBJECT_REPRESENTATION_HPP
Definition adjacent_find.hpp:9
constexpr bool has_unique_object_representations_v
Definition has_unique_object_representations.hpp:35
If T is TriviallyCopyable and if any two objects of type T with the same value have the same object r...
Definition has_unique_object_representations.hpp:32