$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Matthew Herrmann (matthew.herrmann_at_[hidden])
Date: 2006-10-19 00:17:32
>
> Message: 11 Date: Thu, 19 Oct 2006 01:52:32 +0200 From: Janek Kozicki
> <janek_listy_at_[hidden]> Subject: Re: [boost] Runtime Dynamic Dispatch
> (boost-dispatch) To: boost_at_[hidden] Message-ID:
> <20061019015232.42b1ce98_at_absurd> Content-Type: text/plain;
> charset=US-ASCII Dean Michael Berris said: (by the date of Wed, 18 Oct
> 2006 22:24:09 +0800)
>> > Hi Everyone,
>> >
>> > I'm about to make a shameless plug about the runtime dispatch library
>> > I've been working on the past few months (mostly testing and using in
>> > a project), which I've uploaded to the vault:
>> > http://tinyurl.com/ycsq6n for everyone to check out and comment on.
>>
>
> can it be used for multimethods ?
Hi Michael,
It looks like the rival for your library is not a switch statement or an
if-else statement, but a hash_map. In your rationale, you should make
clear what your library can do that the following construct cannot:
template <typename T>
struct dynamic_dispatcher
{
typedef hash_map< T, boost::function<void ()> > type;
};
dynamic_dispatcher<int>::type dispatcher;
dispatcher[0] = boost::bind(&myfun0);
dispatcher[1] = boost::bind(&myfun1);
int i;
std::cin >> i;
dispatcher[i]()
From my reading, the only difference is that hash map's operator[] will
not throw in the case where an element is not found.
Best Regards,
Matthew Herrmann
Zomojo Pty Ltd