std::meta::is_applicable_type, std::meta::is_nothrow_applicable_type - cppreference.com
Namespaces
Variants

std::meta::is_applicable_type, std::meta::is_nothrow_applicable_type

From cppreference.com
< cpp | meta
 
 
 
Reflection library
 
Reflection types and queries
Type properties
Type property queries
 
Defined in header <meta>
consteval bool is_applicable_type( std::meta::info fn,
                                   std::meta::info tuple );
(1) (since C++26)
consteval bool is_nothrow_applicable_type( std::meta::info fn,
                                           std::meta::info tuple );
(2) (since C++26)

Determines whether the type Fn represented by fn can be invoked (as if by std::invoke) with the given tuple-like type of arguments Tuple represented by tuple.

1) Equivalent to return std::is_applicable_v<Fn, Tuple>;.
2) Equivalent to return std::is_nothrow_applicable_v<Fn, Tuple>;.

If either Fn or Tuple is not a complete type, (possibly cv-qualified) void, or an array of unknown bound, the program is ill-formed.

If an instantiation of a template above depends, directly or indirectly, on an incomplete type, and that instantiation could yield a different result if that type were hypothetically completed, the program is ill-formed.

Parameters

fn - a reflection value to check
tuple - a reflection value of a tuple of arguments

Return value

true if the reflected type fn can be invoked with tuple of arguments; false otherwise.

Exceptions

Throws std::meta::exception if either fn or tuple does not represent a type or type alias.

Example

#include <meta>
#include <tuple>

void func(char);

static_assert
(
    std::meta::is_applicable(^^int(), ^^std::tuple<>) &&
    !std::meta::is_applicable(^^int(), ^^std::tuple<int>) &&
    std::meta::is_applicable(^^std::declval(func), ^^std::tuple<char>) &&
    !std::meta::is_applicable(^^std::declval(func), ^^std::tuple<char, int>)
);

int main() {}

See also