tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
is_nothrow_convertible.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_IS_NOTHROW_CONVERTIBLE_HPP
5#define TETL_TYPE_TRAITS_IS_NOTHROW_CONVERTIBLE_HPP
6
7#include <etl/_config/all.hpp>
8
9#include <etl/_type_traits/bool_constant.hpp>
10#include <etl/_type_traits/conjunction.hpp>
11#include <etl/_type_traits/declval.hpp>
12#include <etl/_type_traits/is_void.hpp>
13
14namespace etl {
15
16template <typename From, typename To>
17struct is_nothrow_convertible : bool_constant<is_void_v<From> && is_void_v<To>> { };
18
19template <typename From, typename To>
20 requires requires {
21 static_cast<To (*)()>(nullptr);
22 { declval<void (&)(To) noexcept>()(declval<From>()) } noexcept;
23 }
24struct is_nothrow_convertible<From, To> : true_type { };
25
26template <typename From, typename To>
28
29} // namespace etl
30
31#endif // TETL_TYPE_TRAITS_IS_NOTHROW_CONVERTIBLE_HPP
Definition adjacent_find.hpp:9
constexpr bool is_nothrow_convertible_v
Definition is_nothrow_convertible.hpp:27
Definition is_nothrow_convertible.hpp:17