Created
September 29, 2016 22:37
-
-
Save djarek/56457645f8c0ce7fc00f436fc0f82cb3 to your computer and use it in GitHub Desktop.
This file contains 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
template <typename T, typename U=void, typename... Types> | |
constexpr size_t index() { | |
return std::is_same<T, U>::value ? 0 : 1 + index<T, Types...>(); | |
} | |
template<size_t index, typename... T> | |
struct TypeAtIndex | |
{ | |
using type = typename std::tuple_element<index, std::tuple<T...>>::type; | |
}; | |
template <typename... T> | |
struct TestPackIndex { | |
static constexpr auto value = index<bool ,T...>(); | |
using type = typename TypeAtIndex<value, T...>::type; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment