Topic: Defect Report: Comment on Issue #94
Author: scleary@jerviswebb.com
Date: 2000/03/26 Raw View
LWG Issue #94 has as its proposed resolution to allow additional template
parameters as long as they have default values.
I disagree for the following reason: consider user library code with
template template parameters. For example, a user library object may be
templated on the type of underlying sequence storage to use
(deque/list/vector), since these classes all take the same number and type
of template parameters; this would allow the user to determine the
performance tradeoffs of the user library object. A similar example is a
user library object templated on the type of underlying set storage
(set/multiset) or map storage (map/multimap), which would allow users to
change (within reason) the semantic meanings of operations on that object.
I think that additional template parameters should be forbidden in the
Standard classes. Library writers don't lose any expressive power, and can
still offer extensions because additional template parameters may be
provided by a non-Standard implementation class:
template <class T, class Allocator = allocator<T>, int N = 1>
class __vector
{ ... };
template <class T, class Allocator = allocator<T> >
class vector: public __vector<T, Allocator>
{ ... };
-Steve
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]