diff --git a/obfuscator.hpp b/obfuscator.hpp index 65f01a1..502d44f 100644 --- a/obfuscator.hpp +++ b/obfuscator.hpp @@ -53,28 +53,29 @@ namespace obfs { namespace obfs { - template - struct Sequence; - - template - struct Sequence { + template + struct TypeVal { using value_type = T; constexpr static T value = Val; + }; - using now = Sequence; + struct Nothing {}; + + template + struct Sequence { + using value = TypeVal; using next = Sequence; template - using get = std::conditional_t>; + using index = std::conditional_t>; }; template struct Sequence { - using value_type = T; - constexpr static T value = Val; + using value = TypeVal; template - using get = std::enable_if_t>; + using index = std::conditional_t; }; template @@ -82,27 +83,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 single_elem = Sequence::value>; + template + using getter = typename U::template index; template - using get = TypeSeq...>; + using index = TypeSeq...>; }; } @@ -152,12 +153,9 @@ namespace obfs { template constexpr auto make_string(char const (&str)[size]) { - using pair = Table::get; - // constexpr Encoder encoder = pair::get<0>::value; - // constexpr Decoder decoder = pair::get<1>::value; - - constexpr Encoder encoder = pair::type::value; - constexpr Decoder decoder = pair::next::type::value; + using pair = Table::index; + constexpr Encoder encoder = pair::index<0>::value; + constexpr Decoder decoder = pair::index<1>::value; return make_string(str); }