All Callable Concepts and Invocability Traits
All Callable Concepts and Invocability Traits
A compact scan page for callable-related concepts, invocability traits, and result-type query utilities.
All Callable Concepts and Invocability Traits
A compact scan page for callable-related concepts, invocability traits, and result-type query utilities.
Use reference pages to confirm names, categories, nearby facilities, and the constraints that matter before writing or reviewing code.
std::invocablestd::regular_invocablestd::predicatestd::relationstd::equivalence_relationstd::strict_weak_orderstd::is_invocablestd::is_invocable_rstd::is_nothrow_invocablestd::is_nothrow_invocable_rstd::invoke_resultstd::invokestd::invoke_rstd::functionstd::reference_wrapper#include <concepts>
#include <functional>
template <std::predicate<int> Predicate>
bool accepts(Predicate predicate, int value) {
return std::invoke(predicate, value);
}
This is the modern public-template shape: put the requirement in the signature so users see it immediately instead of discovering it through template errors later.
std::invocable or std::predicate in public templates and overload setsstd::is_invocable_v or related traits inside compatibility layers, static assertions, or conditional metaprogrammingstd::invoke_result_t when another type depends on the result of calling a callable#include <concepts>
#include <functional>
template <std::predicate<int> Predicate>
bool accepts(Predicate predicate, int value) {
return std::invoke(predicate, value);
}
int main() {
return accepts([](int v) { return v % 2 == 0; }, 4) ? 0 : 1;
}