Ulrich Lauther <[email protected]> wrote:
|That templates are not used is a GOOD THING.
I disagree with you, templates are a fantastic thing for
typesafety. The problem i have with STL is the massive code blow.
I instead used all-inline template wrappers of void* based generic
collection types; to be able to manage object there were
template-based type traits and toolboxes, as in (less docu)
template<class T, boolean OWNS=TypeTraits<T>::ownguess>
class Vector
:
private GVector
{
pub typedef CollTraits<Super,T,T> CTraits;
pub typedef TypeTraits<T> TTraits;
pub typedef typename TTraits::Toolbox TToolbox;
pub typedef typename TTraits::AutoToolbox TAutoToolbox;
If you wanted the collection to OWN the object (instances had to
be owned, of course, pointers not necessarily) then there was
a need for a toolbox, as in
auto List<CString> sl1(CString::toolbox)
auto List<CString*,tru1> sl2(CString::toolbox);
Most types had one already, but the AutoToolbox template could
also be used instead (if the object supported some basic
functions, e.g. compare()). Note this scheme couldn't handle
pointer-to-pointer based Ts, but which really didn't matter. It
was lean, fast and easy to use.
--steffen