Yes. And, essentially, this is how tons of STL codes work.
std::vector has a definition like:
template < class T, class Alloc = allocator<T> > class vector
so you donβt have to specify allocator every time every time. If this is not valid, we will not be able to write:
std::vector<int> data;
And you should write std::map as:
std::map < keyType, // map::key_type ValType, // map::mapped_type less<keyType>, // map::key_compare allocator<pair<const KeyType,ValType> > // map::allocator_type > mapping;
which is much less desirable than:
std::map< keyType , ValType > mapping;
source share