Boost logo

Boost :

From: Victor A. Wagner Jr. (vawjr_at_[hidden])
Date: 2005-10-28 00:54:41

At 10:48 2005-10-27, Matt Calabrese wrote:
>On 10/27/05, Victor A. Wagner Jr. <vawjr_at_[hidden]> wrote:
> >
> > OK, fix the core language so that I don't have to write the whole
> > batch of forwarding functions, AND I get the new ones automatically
> > when std::vector gets updated!!
> > No??? don't wanna do that?
> > then it ISA std::vector<> (or whatever STL collection I choose)!!
>Don't use an IS-A relationship just because you want to save time typing.
>Use an IS-A relationship if IS-A makes sense. If you really always want all
>of vector's operations exposed without additional typing, then just
>encapsulate it and make it public. If you want the member functions to be a
>direct part of the encapsulating class, then use private inheritance and
>promote the member functions and types from the vector base class to your
>type's public interface with using-delcarations.

and that gains me what? a LOT of typing (why the heck isn't there
a using class blah; like we have using namespace widget; ??)
that needs to be checked.. and possibly modified every time (well ok,
once every decade or so) the library is updated. A major maintenance
headache just waiting to happen. and I _have_ to make ALL the
methods public and ALL the typedefs because I would like to use my
collection with ALL of the stuff in <algorithm> and you're never
_quite_ sure what an implementation _might_ do or need.

It's not that I'm in love with this idea, I'm just saying that it is
NOT always bad to inherit from a concrete class that doesn't have a
virtual destructor. That's where this all started.
I've done it only in a couple places (from standard library
things).. mostly to satisfy some programmers who've convinced
management that they can't _possibly_ use a string class that doesn't
have (pick one... trim, upcase, whatever)
and I'm very likely to do it to attempt to normalize the container
libraries in the STL as part of an article attempting to shame the
committee into making some changes.

>-Matt Calabrese
>Unsubscribe & other changes:

Victor A. Wagner Jr.
The five most dangerous words in the English language:
               "There oughta be a law"

Boost list run by bdawes at, gregod at, cpdaniel at, john at