Boost logo

Boost :

From: Brock Peabody (brock.peabody_at_[hidden])
Date: 2003-08-01 08:02:01


> -----Original Message-----
> From: boost-bounces_at_[hidden]
[mailto:boost-bounces_at_[hidden]]
> On Behalf Of Douglas Gregor
> Sent: Friday, August 01, 2003 12:40 AM
> To: Boost mailing list
> Subject: Re: [boost] GUI/GDI template library
[..]
> I believe that one bit that falls out of the above agrees 100% with
the
> poster that suggested the following:
>
> class list_control; // implemented by the library. Uses some sort
of
> generic "list element" type
>
> template<typename Element>
> class typed_list_control; // thin wrapper over list_control.
> "Element"
> is the type of the data in the list
>
> As noted earlier, this design has a huge number of benefits:
> 1) list_control is not a template, so we can use the simplified
> cross-platform model used in Boost.Threads, and of course this gives
us
> the
> ability to create a much more dynamic system (e.g., loaded from a
resource
> file) if we choose to.
> 2) typed_list_control gives us all of the great static-checking
> features
> we would want, but in a lightweight veneer.
>
> I've used this model extensively before (e.g., Boost.Signals uses it
to
> shrink the size of boost::signal template instantiations), and it has
> worked
> very well.

This is exactly what I've got in my control library. The base classes
are called callback_list_ctrl, callback_combo_box, and so on, so named
because my focus at the time was in translating Win32 message maps into
boost::function<>. I actually have a class named 'typed_list_ctrl',
also 'typed_combo_box', etc... These are typically vector based. On top
of them I there is mapped_list_ctrl, mapped_combo_box, etc...

You would be amazed at the amount of code that is saved with the 'typed'
version.

I'm going to try getting some sample code into the sandbox, which I've
never used before.


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