Helios Engine 0.1.0
A modular ECS based data-oriented C++23 game engine
 
Loading...
Searching...
No Matches
common_traits.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <helios/core_pch.hpp>
4
5#include <concepts>
6#include <type_traits>
7
8namespace helios::utils {
9
10namespace details {
11
12// Helper: recursively check uniqueness after removing cv/ref.
13// Primary: empty pack => true
14template <typename...>
15struct UniqueTypesHelper : std::true_type {};
16
17// Recursive case
18template <typename T, typename... Rest>
19struct UniqueTypesHelper<T, Rest...> : std::bool_constant<
20 // T must differ from every type in Rest (after remove_cvref)
21 (!(std::same_as<std::remove_cvref_t<T>, std::remove_cvref_t<Rest>> || ...))
22 // and Rest themselves must be unique
23 && UniqueTypesHelper<Rest...>::value> {};
24
25} // namespace details
26
27template <typename T>
28concept ArithmeticTrait = std::integral<T> || std::floating_point<T>;
29
30template <typename... Ts>
31concept UniqueTypes = details::UniqueTypesHelper<Ts...>::value;
32
33} // namespace helios::utils