CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
IndexOf.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 "TypeList.hpp"
11
12#include <type_traits>
13
14namespace CeresEngine::MPL {
15
16 template<typename T, typename TTypeList> struct IndexOfHelper;
17
19 template<typename T, typename TTypeList> inline constexpr size_t IndexOf = IndexOfHelper<T, TTypeList>::value;
20
22 template<typename T, typename... Ts> struct IndexOfHelper<T, TypeList<T, Ts...>> : std::integral_constant<std::size_t, 0> {};
23
25 template<typename T, typename TOther, typename... Ts>
26 struct IndexOfHelper<T, TypeList<TOther, Ts...>> : std::integral_constant<std::size_t, 1 + IndexOf<T, TypeList<Ts...>>> {};
27} // namespace CeresEngine::MPL
Definition All.hpp:15
constexpr size_t IndexOf
Interface alias.
Definition IndexOf.hpp:19
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
Definition IndexOf.hpp:16
Compile-time list of types.
Definition TypeList.hpp:15