In Stroustrup's "A Tour of C++" there is a code snippet
template<typename C>
using Value_type = typename C::value_type; // the type of C’s elements
template<typename Container>
void algo(Container& c)
{
/* (1) */
Vector<Value_type<Container>> vec; // keep results here
// ...
}
Why we need this using
, how it differs from writing in (1)
just
Vector<Container::value_type> vec;
Aucun commentaire:
Enregistrer un commentaire