ПК
Size: a a a
ПК
VS
_
S
_
d
AT
N
struct A {
void foo(int);
};
std::is_invocable_r<void, decltype(&A::foo), A, int>::value
АК
#include <concepts>
template <class T>
concept has_foo = std::same_as<decltype(&T::foo), int(T::*)(float)>;
struct A {};
struct B { int foo(); };
struct C { int foo(float); };
static_assert(!has_foo<int>);
static_assert(!has_foo<A>);
static_assert(!has_foo<B>);
static_assert(has_foo<C>);
AF
AF
AT
#include <concepts>
template <class T>
concept has_foo = std::same_as<decltype(&T::foo), int(T::*)(float)>;
struct A {};
struct B { int foo(); };
struct C { int foo(float); };
static_assert(!has_foo<int>);
static_assert(!has_foo<A>);
static_assert(!has_foo<B>);
static_assert(has_foo<C>);
A
struct A {
void foo(int);
};
std::is_invocable_r<void, decltype(&A::foo), A, int>::value
АК
AT
S
template <typename T, typename = void>
struct is_iterable : std::false_type {};
template <typename T>
struct is_iterable<T, std::void_t<decltype(std::declval<T>().begin()),
decltype(std::declval<T>().end())>>
: std::true_type {};
AT
N
template <typename T, typename = void>
struct has_foo
: std::false_type {};
template <typename T>
struct has_foo<T, std::void_t<decltype(&T::foo)>>
: std::is_invocable_r<int, decltype(&T::foo), T, int> {};
struct A {};
struct B { int foo(); };
struct C { int foo(float); };
static_assert(!has_foo<int>::value);
static_assert(!has_foo<A>::value);
static_assert(!has_foo<B>::value);
static_assert(has_foo<C>::value);
АК
OZ