std::meta::is_noexcept
From cppreference.com
| Defined in header <meta>
|
||
consteval bool is_noexcept( std::meta::info r );
|
(since C++26) | |
Returns true if r represents a noexcept function type or a function with a non-throwing exception specification. Otherwise returns false.
Parameters
| r | - | a reflection value |
Return value
true if r represents a noexcept function type or function; otherwise false.
Notes
If r does not represent a function type or function, the result is false. In particular, the result is false if r represents a function template.
Example
Run this code
#include <meta>
template<bool Cond>
void f() noexcept(Cond);
static_assert(std::meta::is_noexcept(^^f<true>));
static_assert(!std::meta::is_noexcept(^^f<false>));
static_assert(!std::meta::is_noexcept(^^f));
using fty = decltype(f<true>);
static_assert(std::meta::is_noexcept(^^fty));
int main() {}
See also
Template:cpp/meta/dsc is function type(C++26) |
checks if reflection represents a function (function) |
(C++11) |
checks if a type is a function type (class template) |