From 5c716a65a38dfdf79fa0a64e9c25b49d6e722326 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 14 Jul 2018 08:41:43 +0200 Subject: fix --- main-window/mixin-traits.cpp | 11 ++++++----- main-window/mixin-traits.hpp | 30 ++++++++++++++++-------------- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/main-window/mixin-traits.cpp b/main-window/mixin-traits.cpp index f914605e..a374eade 100644 --- a/main-window/mixin-traits.cpp +++ b/main-window/mixin-traits.cpp @@ -3,7 +3,7 @@ #ifdef MIXIN_TRAIT_TESTS # include "mixin-traits.hpp" -namespace mixins::traits_detail { +//namespace mixins::traits_detail { struct A {}; struct B : A {}; @@ -16,22 +16,23 @@ template<> struct mixin_traits template<> struct mixin_traits { - using depends = tuple; + using depends = tuple<>; }; template<> struct mixin_traits { - using depends = tuple; + using depends = tuple; }; extern void test1(); void test1() { - //impl fail1; + //impl fail1; impl ok1; + impl ok2; } -} // ns mixins::traits_detail +//} // ns mixins::traits_detail #endif diff --git a/main-window/mixin-traits.hpp b/main-window/mixin-traits.hpp index 5988dc83..07eec98d 100644 --- a/main-window/mixin-traits.hpp +++ b/main-window/mixin-traits.hpp @@ -6,15 +6,15 @@ #include -namespace mixins::traits_detail { +//namespace mixins::traits_detail { using namespace meta; template - using tuple = meta::detail::tuple {} + using tuple = meta::detail::tuple; template struct mixin_traits { - using depends = tuple<>; + //using depends = tuple<>; }; template struct check_depends_; @@ -22,20 +22,21 @@ namespace mixins::traits_detail { template struct check_depends_ { - static constexpr bool recurse() { return true; } + using type = std::bool_constant; }; template struct check_depends_ { - static constexpr bool recurse() - { - using depends = typename mixin_traits::depends; - - return (std::is_base_of_v || std::is_same_v) && - check_depends_::recurse() && - lift>::recurse(); - } + using b1 = std::is_base_of; + using b2 = typename check_depends_::type; + + using depends = typename mixin_traits::depends; + using t1 = cons; + using t2 = lift; + using b3 = typename t2::type; + + using type = std::bool_constant; }; #if 0 @@ -58,6 +59,7 @@ namespace mixins::traits_detail { template class impl { - static_assert(lift::depends>>::recurse()); + using t1 = typename lift::depends>>::type; + static_assert(t1::value); }; -} // ns mixins::traits_detail +//} // ns mixins::traits_detail -- cgit v1.2.3