From d7f466215efdb65a49d0793dcdc2c25dd4b9e372 Mon Sep 17 00:00:00 2001 From: revsic Date: Tue, 19 Feb 2019 03:49:28 +0900 Subject: [PATCH] obfs, seq: Fix compile err --- obfuscator/impl/sequence.hpp | 40 +++++++++++++++++------------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/obfuscator/impl/sequence.hpp b/obfuscator/impl/sequence.hpp index 962c4b2..aadfcba 100644 --- a/obfuscator/impl/sequence.hpp +++ b/obfuscator/impl/sequence.hpp @@ -4,34 +4,29 @@ #include namespace obfs { - template - struct Sequence { + template + struct TypeVal { using value_type = T; constexpr static T value = Val; + }; + struct Nothing {}; + + template + struct Sequence { + using value = TypeVal; using next = Sequence; template - constexpr static T get() { - if constexpr (Idx == 0) { - return value; - } - else { - return next::get(); - } - } + using index = std::conditional_t>; }; template struct Sequence { - using value_type = T; - constexpr static T value = Val; + using value = TypeVal; template - constexpr static T get() { - static_assert(Idx == 0, "Couldn't get proper value from sequence"); - return value; - } + using index = std::conditional_t; }; template @@ -39,24 +34,27 @@ namespace obfs { using type = T; using next = TypeSeq; - // template - // using get = std::conditional_t>; + template + using index = std::conditional_t>; }; template struct TypeSeq { using type = T; - // template - // using get = std::enable_if_t; + template + using index = std::conditional_t; }; template struct SeqPack { constexpr static std::size_t size = sizeof...(T); + template + using getter = typename U::template index; + template - using get = TypeSeq>...>; + using index = TypeSeq...>; }; }