#include<tuple>
#include<type_traits>
#include<string>
#include<iostream>

template<int Index, class Search, class First, class... Types>
struct get_internal
{
	typedef typename get_internal<Index + 1, Search, Types...>::type type;
        static constexpr int index = Index;
};

template<int Index, class Search, class... Types>
struct get_internal<Index, Search, Search, Types...>
{
	typedef get_internal type;
	static constexpr int index = Index;
};

template<class T, class... Types>
T get(std::tuple<Types...> tuple)
{
	return std::get<get_internal<0,T,Types...>::type::index>(tuple);
}

int main()
{
	std::tuple<int, double, std::string> test{1, 1.7, "test"};
	std::cout<<"get<0> == get<int> :"<< (std::get<0>(test) == get<int>(test))<< "\n";
	std::cout<<"get<1> == get<double> :"<<(std::get<1>(test) == get<double>(test))<< "\n";
    std::cout<<"get<2> == get<std::string> :"<<(std::get<2>(test) == get<std::string>(test))<< "\n";
}