Reports whether evaluation occurs in a constant context, with a default.

Synopsis

Declared in <folly/portability/Constexpr.h>

constexpr
bool
is_constant_evaluated_or(/* implementation-defined */ const def) noexcept;

Description

Similar in spirit to std::is_constant_evaluated (C++20), but takes an argument used as the default return value when the code cannot tell whether it is in a constant context.

Return Value

True if evaluated in a constant context, otherwise def.

Parameters

Name

Description

def

The value returned when the constant context cannot be detected.

Created with MrDocs