blob: 45df7fdbb6dd36728969575efcfa95be43eaf130 (
plain)
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
31
32
33
34
35
36
37
38
39
40
41
42
|
#pragma once
#include "compat/meta.hpp"
#include <type_traits>
namespace mixins::traits_detail {
using namespace meta;
template<typename... xs> using tuple = tuple_<xs...>;
template<typename t>
struct mixin_traits {
// implement this!
//using depends = tuple<>;
};
template<typename klass, typename...> struct check_depends_;
template<typename klass>
struct check_depends_<klass> : std::true_type
{
};
template<typename klass, typename x, typename... xs>
struct check_depends_<klass, x, xs...> :
std::bool_constant<
std::is_base_of_v<x, klass> &&
lift_v<check_depends_, cons<klass, typename mixin_traits<x>::depends>> &&
check_depends_<klass, xs...>::value
>
{
};
template<typename klass, typename... xs>
struct impl
{
static_assert(lift<check_depends_, tuple<klass, xs...>>::value,
"class must inherit dependent mixins");
};
} // ns mixins::traits_detail
|