tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
is_constant_evaluated.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2
3#ifndef TETL_TYPE_TRAITS_IS_CONSTANT_EVALUATED_HPP
4#define TETL_TYPE_TRAITS_IS_CONSTANT_EVALUATED_HPP
5
6#include <etl/_config/all.hpp>
7
8namespace etl {
9
16[[nodiscard]] constexpr auto is_constant_evaluated() noexcept -> bool
17{
18#if __has_builtin(__builtin_is_constant_evaluated)
19 return __builtin_is_constant_evaluated();
20#else
21 return false;
22#endif
23}
24
25} // namespace etl
26
27#endif // TETL_TYPE_TRAITS_IS_CONSTANT_EVALUATED_HPP
Definition adjacent_find.hpp:8
constexpr auto is_constant_evaluated() noexcept -> bool
Detects whether the function call occurs within a constant-evaluated context. Returns true if the eva...
Definition is_constant_evaluated.hpp:16