From: Jody Hagins (jody-boost-011304_at_[hidden])
Date: 2004-03-09 12:37:28
On Tue, 9 Mar 2004 11:30:15 -0500
Douglas Gregor <gregod_at_[hidden]> wrote:
> > I also need an efficient way for accessing slots randomly.
> > For instance some of the Win32 listbox messages
> > have item indexes. I'd like to implement each
> > item as a slot, but I need a way to access
> > the slots based on the item index, so I could call
> > just the right slot.
> > listboxes can contain a lot of items so propagating
> > the messages to all items is not an option.
> That'd be a much bigger change to Signals. For one, we'd be breaking
> the logarithmic complexity of inserting a new element in a particular
If I understand the original statement, I have a similar requirement,
and have done it by implementing an addition class, I call multisignal
(after multimap, multiset, and so forth). It basically holds an
addition to the tuple library that I call dynamic_tuple, which provides
direct access to any type, while preserving type safety both at run time
and compile time. You can use a type as an index into a dynamic_tuple,
and still get constant time lookup. This forms a basis for the
multisignal, which provides a wrapper around Boost.Signal to allow
multiple signals to be raised, using the same signal object. The
algorithmic complexity can be minimized to constant time lookup of the
signal object using another libary I call type_to_index, which provides
a special zero-based index for a specific type, relative to the
collection in which the type is used as an index.
Sounds complicated, but it is quite simple. However, to get the
type_to_index, you have to create explicit template instantiations, or
allow static data members (which some are opposed to, depending on OS
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk