Skip to content

feat(concepts): integrate C++20 Concepts with unified thread_concepts.h#279

Merged
kcenon merged 5 commits into
mainfrom
feature/cpp20-concepts-integration
Dec 9, 2025
Merged

feat(concepts): integrate C++20 Concepts with unified thread_concepts.h#279
kcenon merged 5 commits into
mainfrom
feature/cpp20-concepts-integration

Conversation

@kcenon

@kcenon kcenon commented Dec 9, 2025

Copy link
Copy Markdown
Owner

Summary

  • Add unified thread_concepts.h header centralizing all C++20 Concepts
  • Refactor pool_traits.h and type_traits.h to use centralized concepts
  • Remove ~30% code duplication in concept definitions
  • Improve template error messages with clearer concept constraints

Changes

New Files

  • include/kcenon/thread/concepts/thread_concepts.h: Unified concepts header

Modified Files

  • include/kcenon/thread/core/pool_traits.h: Use thread_concepts.h
  • include/kcenon/thread/impl/typed_pool/type_traits.h: Use thread_concepts.h
  • docs/CHANGELOG.md: Document changes

Concepts Added

Concept Purpose
Callable Types invocable with no arguments
VoidCallable Callable returning void
ReturningCallable Callable returning non-void
CallableWith<F, Args...> Callable with specific arguments
Duration std::chrono::duration types
FutureLike Types with get() and wait() methods
JobType Enum or integral types (excluding bool)
JobCallable Job callback functions
PoolJob Valid thread pool job types

Backward Compatibility

  • Full C++17 fallback using constexpr bool
  • Concepts re-exported to detail namespace
  • All existing code continues to work unchanged

Test plan

  • All smoke tests pass
  • All integration tests pass
  • Build succeeds with no errors
  • Only expected warnings (unrelated to this change)

Closes #271, closes #272, closes #273, closes #274

- Create centralized C++20 Concepts header for thread_system
- Define Callable, VoidCallable, ReturningCallable concepts
- Define JobType, JobCallable, PoolJob concepts
- Add Duration and FutureLike type detection concepts
- Provide C++17 fallback using constexpr bool
- Re-export concepts to detail namespace for backward compatibility

Part of #271, closes #272
- Remove duplicated concept definitions (Callable, VoidCallable, etc.)
- Import concepts from thread_concepts.h instead
- Fix callable_eraser with proper move semantics and destructor
- Use requires clause for C++20 concepts where applicable
- Maintain C++17 fallback compatibility

Part of #271, closes #273
- Remove duplicated JobType and JobCallable concept definitions
- Import concepts from thread_concepts.h instead
- Use requires clause for C++20 concepts where applicable
- Simplify template constraints using concepts directly
- Maintain C++17 fallback compatibility

Part of #271, closes #274
- Document new thread_concepts.h header and unified concepts
- Document pool_traits.h and type_traits.h refactoring
- List all new concepts and type traits added
- Note backward compatibility and C++17 fallback support

Part of #271
- Keep both Issue #271 (thread_concepts.h) and Issue #276 (CMake config) entries
- Maintain chronological order of additions
@github-actions

github-actions Bot commented Dec 9, 2025

Copy link
Copy Markdown
Contributor

📊 Performance Benchmark Results

Performance Benchmark Report

No benchmark data available.

ℹ️ No baseline reference available

This is the first benchmark run or baseline file is missing.

@kcenon kcenon merged commit dbc3363 into main Dec 9, 2025
25 checks passed
@kcenon kcenon deleted the feature/cpp20-concepts-integration branch December 9, 2025 09:37
kcenon added a commit that referenced this pull request Apr 13, 2026
….h (#279)

* feat(concepts): add unified thread_concepts.h header

- Create centralized C++20 Concepts header for thread_system
- Define Callable, VoidCallable, ReturningCallable concepts
- Define JobType, JobCallable, PoolJob concepts
- Add Duration and FutureLike type detection concepts
- Provide C++17 fallback using constexpr bool
- Re-export concepts to detail namespace for backward compatibility

Part of #271, closes #272

* refactor(pool_traits): use unified thread_concepts.h

- Remove duplicated concept definitions (Callable, VoidCallable, etc.)
- Import concepts from thread_concepts.h instead
- Fix callable_eraser with proper move semantics and destructor
- Use requires clause for C++20 concepts where applicable
- Maintain C++17 fallback compatibility

Part of #271, closes #273

* refactor(type_traits): use unified thread_concepts.h

- Remove duplicated JobType and JobCallable concept definitions
- Import concepts from thread_concepts.h instead
- Use requires clause for C++20 concepts where applicable
- Simplify template constraints using concepts directly
- Maintain C++17 fallback compatibility

Part of #271, closes #274

* docs(changelog): add C++20 concepts integration entry

- Document new thread_concepts.h header and unified concepts
- Document pool_traits.h and type_traits.h refactoring
- List all new concepts and type traits added
- Note backward compatibility and C++17 fallback support

Part of #271
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant