groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Groff] Overview, Sept. 2014


From: Steffen Nurpmeso
Subject: Re: [Groff] Overview, Sept. 2014
Date: Thu, 11 Sep 2014 13:09:19 +0200
User-agent: s-nail v14.7.6-15-gc1887ab

Ulrich Lauther <address@hidden> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]