SysTutorials

Linux Manual Pages › Section 3

stdis_constant_evaluated(3)

std::is_constant_evaluated - std::is_constant_evaluated

Synopsis

Defined in header <type_traits> constexpr bool is_constant_evaluated() noexcept; (since C++20) Detects whether the function call occurs within a constant-evaluated context. Returns true if the evaluation of the call occurs within the evaluation of an expression or conversion that is manifestly constant-evaluated; otherwise returns false. The following expressions (including conversions to the destination type) are manifestly constant-evaluated:

Parameters

(none)

Return value

true if the evaluation of the call occurs within the evaluation of an expression or conversion that is manifestly constant-evaluated; otherwise false

Notes

When directly used as the condition of static_assert_declaration or constexpr_if_statement, std::is_constant_evaluated() always returns true.

Example

 This section is incomplete  Reason: no example