12345678
template <class T> T loopthrough( T element){ typedef std::string::std::iterator q; q = element.begin(); for(q = element.begin(); q != element.end(); q++){ std::cout << *q << std::endl; } }
123456789101112131415
template < typename SEQUENCE > void print( const SEQUENCE& seq ) { // using iterator = decltype( std::begin(seq) ) ; // type alias for the type of iterator // auto is simpler for( auto iter = std::begin(seq) ; iter != std::end(seq) ; ++iter ) { std::cout << *iter << ' ' ; } std::cout << '\n' ; } template < typename SEQUENCE > void easy_print( const SEQUENCE& seq ) { for( const auto& value : seq ) std::cout << value << ' ' ; std::cout << '\n' ; }
std::string::iterator q = element.begin();