Boost logo

Boost :

From: Pavel Vozenilek (pavel_vozenilek_at_[hidden])
Date: 2004-01-18 16:59:58


"Jonathan Turkanis" <technews_at_[hidden]> wrote

> > Often one would like to have some data value associated with a
> > container.
> >
> Why not:
>
> struct WindowList : list<WindowControl*> : noncopyable {
> WindowList() : parent(0) { }
> WindowControl* parent;
> };
> ?
>
Well, it adds one layer to object hierarchy. I personally find this
as unnecessary complicating design.
Associated data should not be so intrusive.

Woudn't you like more an "attachment policy"?

Other point is that you may too easily convert it to list<...> pointer
(and loose associated data in the process)
and you may easily delete the list<...> pointer.

> > Sample Implementation:
> Could you post it at Yahoo? My virus software ate your attachment
> (and the partially digested version is hard to read :-)
>
Done, file associated_data.cpp.

/Pavel


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk