-
Notifications
You must be signed in to change notification settings - Fork 1
/
dsl_partreduce.h
30 lines (22 loc) · 962 Bytes
/
dsl_partreduce.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifndef DSL_PARTREDUCE_H_INCLUDED
#define DSL_PARTREDUCE_H_INCLUDED
#include "configuration.h"
#include "generator.h"
#include <type_traits>
template<class T>
struct ReducerEndElement{};
template<template<template<class>class...>class PartsFor, template<class>class In = ReducerEndElement, template<class>class... InParts>
struct Reduce{
template<template<class>class... OutParts>
using Result = typename conditional<Config<OutParts...>::template containsPart<In>(),
typename Reduce<PartsFor,InParts...>::template Result<OutParts...>,
typename Reduce<PartsFor,InParts...>::template Result<OutParts..., In>>
::type;
using Gen = Result<>;
};
template<template<template<class>class...>class PartsFor>
struct Reduce<PartsFor, ReducerEndElement>{
template<template<class>class... OutParts>
using Result = PartsFor<OutParts...>;
};
#endif // DSL_PARTREDUCE_H_INCLUDED