
On Wed, 10 Oct 2007 08:24:08 +0200, Johan Nilsson <r.johan.nilsson@gmail.com> wrote:
Michael Fawcett wrote:
On 10/9/07, Dean Michael Berris <mikhailberis@gmail.com> wrote:
I thought about this, and the only problem is that it assumes that 'include' does not replace the already existing mapping between a function signature and the actual function being 'included'.
[snip]
I'll persist (yes, yes ... the imfamous bicycle shed): What's wrong with add:
functions.add(&foo); functions.add(&foo); // Throws functions.insert(&foo); // Returns false functions.replace(&foo); // Overwrites if exists, inserts if not
The above is based on the fact that only one overload of each signature is stored - analogous to method overloads.
If some kind of multiple dispatch is desired - how about "multi_overloads" (compare set/multiset, map/multimap).
/ Johan
Well, my point of view is that you shouldn't see the proposed implementation as a container but just as an extension of Boost.Function. It would be overkilling if Boost.Function had method like "insert" and "replace" instead of a simple operator= , and, IMO, the same it's true for the proposed overload implementation. Regards, Marco -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/