Skip to content

Instantly share code, notes, and snippets.

@yaneury
Created May 16, 2017 16:37
Show Gist options
  • Select an option

  • Save yaneury/8310d23de76dce0953fbee24cf1e8f97 to your computer and use it in GitHub Desktop.

Select an option

Save yaneury/8310d23de76dce0953fbee24cf1e8f97 to your computer and use it in GitHub Desktop.
#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