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.

How to use this reference page

Use reference pages to confirm names, categories, nearby facilities, and the constraints that matter before writing or reviewing code.

  • Scan the top of the page first to identify the primary types, functions, or algorithm families involved.
  • Use the nearby-page links when your question is really about a companion header, related algorithm family, or broader subsystem.
  • Validate tricky behavior with a small compileable example before relying on memory for details like invalidation, ordering, allocation, or lifetime rules.

All Callable Concepts and Invocability Traits

Callable concepts

Invocability traits

Practical rules

Small worked example

#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.

Concepts vs traits

Example in practice

#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;
}