Код: Выделить всё
#include
#include
#include
#include
#include
template < typename T>
void Print()
{
std::cout
void Funny( const T& t )
{
using ELEMENT_TYPE = decltype( GetFirst(*(std::declval().begin())) );
Print< ELEMENT_TYPE> ();
}
std::vector> s1{ {1, 2.9} };
struct T2 { std::string s; bool b; };
std::array s2{ "Hallo", true};
int main()
{
Funny( s1 );
Funny( s2 );
}
< /code>
, который приводит к: < /p>
void Print() [with T = int]
void Print() [with T = std::__cxx11::basic_string]
Подробнее здесь: https://stackoverflow.com/questions/797 ... tured-type