tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
unwrap_reference.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2// SPDX-FileCopyrightText: Copyright (C) 2021 Tobias Hienzsch
3
4#ifndef TETL_TYPE_TRAITS_UNWRAP_REFERENCE_HPP
5#define TETL_TYPE_TRAITS_UNWRAP_REFERENCE_HPP
6
7#include <etl/_type_traits/conditional.hpp>
8#include <etl/_type_traits/decay.hpp>
9#include <etl/_type_traits/is_same.hpp>
10
11namespace etl {
12
13template <typename T>
15
16template <typename T>
17struct unwrap_reference;
18
19template <typename T>
20struct unwrap_reference<reference_wrapper<T>> {
21 using type = T&;
22};
23
24template <typename T>
25using unwrap_reference_t = typename unwrap_reference<T>::type;
26
27template <typename T>
28struct unwrap_ref_decay : conditional_t<not is_same_v<decay_t<T>, T>, unwrap_reference<decay_t<T>>, decay<T>> { };
29
30template <typename T>
31using unwrap_ref_decay_t = typename unwrap_ref_decay<T>::type;
32
33} // namespace etl
34
35#endif // TETL_TYPE_TRAITS_UNWRAP_REFERENCE_HPP
Definition adjacent_find.hpp:9
Applies lvalue-to-rvalue, array-to-pointer, and function-to-pointer implicit conversions to the type ...
Definition decay.hpp:21
reference_wrapper is a class template that wraps a reference in a copyable, assignable object....
Definition reference_wrapper.hpp:41
Definition unwrap_reference.hpp:28