CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
Unique.hpp
Go to the documentation of this file.
1//
2// CeresEngine - A game development framework
3//
4// Created by Rogiel Sulzbach.
5// Copyright (c) 2018-2022 Rogiel Sulzbach. All rights reserved.
6//
7
8#pragma once
9
10#include "Count.hpp"
11#include "TypeList.hpp"
12
13#include <type_traits>
14
15namespace CeresEngine::MPL {
16
17 template<typename TTypeList> struct UniqueHelper : std::true_type {};
18
19 template<typename... Ts> inline constexpr bool Unique = UniqueHelper<TypeList<Ts...>>::value;
20
21 template<typename T, typename... Ts>
22 struct UniqueHelper<TypeList<T, Ts...>> : std::integral_constant<bool, (Count<T, TypeList<T, Ts...>> <= 1) && UniqueHelper<TypeList<Ts...>>::value> {};
23
24} // namespace CeresEngine::MPL
Definition All.hpp:15
constexpr bool Unique
Definition Unique.hpp:19
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
Compile-time list of types.
Definition TypeList.hpp:15
Definition Unique.hpp:17