REH wrote:
GCC accepts this in a template parameter list:
template<class> class T = std::vector
However Visual C++ conplains because the actual template parameter list of
std::vector does not match, because of course the defaulted allocator
parameter. So, technically its correct. But what does the standard say?
Does it allow the above? Stroustrup's "The C++ Programming Language" (SE)
uses the above in several examples.
The acceptance of this depends on the implementation of 'std::vector'.
It is possible that the implementation has only one argument for that
template. In that case the code is valid. It is also possible that
the implementation has several arguments, in which case the program that
_assumes_ only one argument is ill-formed.
Until "template typedefs" are introduced into the language, you could
work around the error by wrapping the 'std::vector' into another template:
template<class T> struct vector_def_alloc {
typedef std::vector<T> type; // the allocator used is the default
};
.... template<class> class T = vector_def_alloc::type ...
(or something like that)
V