CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
Filter.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 "Concat.hpp"
11#include "TypeList.hpp"
12
13#include <type_traits>
14
15namespace CeresEngine::MPL {
16
18 template<template<typename> class TTypePred, typename> struct FilterHelper { using type = TypeList<>; };
19
21 template<template<typename> class TTypePred, typename TTypeList> using Filter = typename FilterHelper<TTypePred, TTypeList>::type;
22
24 template<template<typename> class TTypePred, typename T, typename... Ts> struct FilterHelper<TTypePred, TypeList<T, Ts...>> {
26 using type = std::conditional_t<TTypePred<T>::value, Concat<TypeList<T>, Next>, Next>;
27 };
28} // namespace CeresEngine::MPL
Definition All.hpp:15
typename ConcatHelper< TTypeLists... >::type Concat
Interface type alias.
Definition Concat.hpp:20
typename FilterHelper< TTypePred, TTypeList >::type Filter
Interface type alias.
Definition Filter.hpp:21
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
Filter< TTypePred, TypeList< Ts... > > Next
Definition Filter.hpp:25
std::conditional_t< TTypePred< T >::value, Concat< TypeList< T >, Next >, Next > type
Definition Filter.hpp:26
Filter base case: empty list.
Definition Filter.hpp:18
Compile-time list of types.
Definition TypeList.hpp:15