Common System 0.2.0
Common interfaces and patterns for system integration
Loading...
Searching...
No Matches
callable.h File Reference

C++20 concepts for callable types and executor interfaces. More...

#include <concepts>
#include <type_traits>
#include <functional>
#include <string>
#include <future>
#include <memory>
#include <chrono>
#include "../patterns/result/core.h"
Include dependency graph for callable.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  kcenon
 
namespace  kcenon::common
 Core interfaces.
 
namespace  kcenon::common::interfaces
 
namespace  kcenon::common::concepts
 C++20 concepts for compile-time type validation.
 

Concepts

concept  kcenon::common::concepts::Invocable
 A callable type that can be invoked with given arguments.
 
concept  kcenon::common::concepts::VoidCallable
 A callable type that returns void when invoked.
 
concept  kcenon::common::concepts::ReturnsResult
 A callable type that returns a value convertible to the specified type.
 
concept  kcenon::common::concepts::NoexceptCallable
 A callable type that is marked noexcept.
 
concept  kcenon::common::concepts::Predicate
 A callable type that returns a boolean value.
 
concept  kcenon::common::concepts::UnaryFunction
 A callable type that takes a single argument.
 
concept  kcenon::common::concepts::BinaryFunction
 A callable type that takes two arguments.
 
concept  kcenon::common::concepts::JobLike
 A type that satisfies the Job interface requirements.
 
concept  kcenon::common::concepts::ExecutorLike
 A type that satisfies the Executor interface requirements.
 
concept  kcenon::common::concepts::TaskFactory
 A callable that creates a job or task.
 
concept  kcenon::common::concepts::AsyncCallable
 A callable suitable for async execution returning a future.
 
concept  kcenon::common::concepts::DelayedCallable
 A callable suitable for delayed execution.
 

Detailed Description

C++20 concepts for callable types and executor interfaces.

This header provides concepts for validating callable types used in task execution, job scheduling, and async operations. These concepts replace SFINAE-based constraints with clearer compile-time errors.

Requirements:

  • C++20 compiler with concepts support
  • GCC 10+, Clang 10+, MSVC 2022+

Thread Safety:

  • Concepts are evaluated at compile-time only.
  • No runtime thread-safety considerations apply.
See also
executor_interface.h for IExecutor implementation
https://en.cppreference.com/w/cpp/concepts/invocable

Definition in file callable.h.