Thread System 0.3.1
High-performance C++20 thread pool with work stealing and DAG scheduling
Loading...
Searching...
No Matches
thread_concepts.h File Reference

C++20 Concepts for thread_system. More...

#include <type_traits>
#include <functional>
#include <chrono>
#include <string>
Include dependency graph for thread_concepts.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  kcenon::thread::concepts::is_duration< T >
 Type trait to detect if a type is a std::chrono::duration. More...
 
struct  kcenon::thread::concepts::is_duration< std::chrono::duration< Rep, Period > >
 
struct  kcenon::thread::concepts::has_get_method< T, typename >
 SFINAE helper to detect if a type has a get() method. More...
 
struct  kcenon::thread::concepts::has_get_method< T, std::void_t< decltype(std::declval< T >().get())> >
 
struct  kcenon::thread::concepts::has_wait_method< T, typename >
 SFINAE helper to detect if a type has a wait() method. More...
 
struct  kcenon::thread::concepts::has_wait_method< T, std::void_t< decltype(std::declval< T >().wait())> >
 
struct  kcenon::thread::concepts::is_future_like< T >
 Type trait to detect future-like types (has get() and wait() methods) More...
 
struct  kcenon::thread::concepts::callable_return_type< F, typename >
 Type trait to extract return type from a callable. More...
 
struct  kcenon::thread::concepts::callable_return_type< F, std::enable_if_t< std::is_invocable_v< F > > >
 
struct  kcenon::thread::concepts::is_valid_job_type< T, typename >
 SFINAE helper for JobType validation. More...
 
struct  kcenon::thread::concepts::is_valid_job_type< T, std::enable_if_t< JobType< T > > >
 
struct  kcenon::thread::concepts::is_nothrow_callable< F >
 Helper to check if a callable is noexcept. More...
 

Namespaces

namespace  kcenon
 
namespace  kcenon::thread
 Core threading foundation of the thread system library.
 
namespace  kcenon::thread::concepts
 
namespace  kcenon::thread::detail
 

Typedefs

template<typename F >
using kcenon::thread::concepts::callable_return_type_t = typename callable_return_type<F>::type
 

Variables

template<typename T >
constexpr bool kcenon::thread::concepts::is_duration_v = is_duration<T>::value
 
template<typename T >
constexpr bool kcenon::thread::concepts::has_get_method_v = has_get_method<T>::value
 
template<typename T >
constexpr bool kcenon::thread::concepts::has_wait_method_v = has_wait_method<T>::value
 
template<typename T >
constexpr bool kcenon::thread::concepts::is_future_like_v = is_future_like<T>::value
 
template<typename F >
constexpr bool kcenon::thread::concepts::Callable = std::is_invocable_v<F>
 Fallback for Callable concept.
 
template<typename F >
constexpr bool kcenon::thread::concepts::VoidCallable
 Fallback for VoidCallable concept.
 
template<typename F >
constexpr bool kcenon::thread::concepts::ReturningCallable
 Fallback for ReturningCallable concept.
 
template<typename F , typename... Args>
constexpr bool kcenon::thread::concepts::CallableWith = std::is_invocable_v<F, Args...>
 Fallback for CallableWith concept.
 
template<typename T >
constexpr bool kcenon::thread::concepts::Duration = is_duration_v<T>
 Fallback for Duration concept.
 
template<typename T >
constexpr bool kcenon::thread::concepts::FutureLike = is_future_like_v<T>
 Fallback for FutureLike concept.
 
template<typename T >
constexpr bool kcenon::thread::concepts::JobType
 Fallback for JobType concept.
 
template<typename F >
constexpr bool kcenon::thread::concepts::JobCallable
 Fallback for JobCallable concept.
 
template<typename Job >
constexpr bool kcenon::thread::concepts::PoolJob
 Fallback for PoolJob concept.
 
template<typename T >
constexpr bool kcenon::thread::concepts::is_valid_job_type_v = is_valid_job_type<T>::value
 
template<typename F >
constexpr bool kcenon::thread::concepts::is_nothrow_callable_v = is_nothrow_callable<F>::value
 
template<typename F >
constexpr bool kcenon::thread::detail::Callable = concepts::Callable<F>
 
template<typename F >
constexpr bool kcenon::thread::detail::VoidCallable = concepts::VoidCallable<F>
 
template<typename F >
constexpr bool kcenon::thread::detail::ReturningCallable = concepts::ReturningCallable<F>
 
template<typename F , typename... Args>
constexpr bool kcenon::thread::detail::CallableWith = concepts::CallableWith<F, Args...>
 
template<typename T >
constexpr bool kcenon::thread::detail::Duration = concepts::Duration<T>
 
template<typename T >
constexpr bool kcenon::thread::detail::FutureLike = concepts::FutureLike<T>
 
template<typename T >
constexpr bool kcenon::thread::detail::JobType = concepts::JobType<T>
 
template<typename F >
constexpr bool kcenon::thread::detail::JobCallable = concepts::JobCallable<F>
 
template<typename Job >
constexpr bool kcenon::thread::detail::PoolJob = concepts::PoolJob<Job>
 

Detailed Description

C++20 Concepts for thread_system.

This file provides unified C++20 Concepts for the thread_system library. It defines concepts for:

  • Callable validation (Callable, VoidCallable, ReturningCallable)
  • Job type constraints (JobType, JobCallable)
  • Duration and future-like type detection
  • Thread pool job validation (PoolJob)

When USE_STD_CONCEPTS is defined, these are true C++20 concepts. Otherwise, constexpr bool fallbacks are provided for C++17 compatibility.

Note
This header centralizes all concept definitions to avoid duplication across pool_traits.h and type_traits.h.

Definition in file thread_concepts.h.