Created
May 16, 2017 16:37
-
-
Save yaneury/8310d23de76dce0953fbee24cf1e8f97 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <type_traits> | |
| template <typename Id> | |
| struct BoolTemplateType { | |
| using TypeId = Id; | |
| }; | |
| struct UseFooterId; | |
| struct UseFooter : BoolTemplateType<UseFooterId> {}; | |
| template<typename T, typename... Args> | |
| struct IsPresent; | |
| template<typename T0, typename T1, typename... Args> | |
| struct IsPresent<T0, T1, Args...> : std::integral_constant<bool, std::is_same<T0, T1>::value | |
| || IsPresent<T0, Args...>::value> {}; | |
| template<typename T> | |
| struct IsPresent<T> : std::false_type {}; | |
| template <typename ...Args> | |
| struct Allocator { | |
| static constexpr const auto _UseFooter = IsPresent<UseFooter, Args...>::value; | |
| }; | |
| int main () { | |
| using T0 = Allocator<UseFooter>; | |
| using T1 = Allocator<>; | |
| return T0::_UseFooter; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment