Boost logo

Boost :

From: Marco (mrcekets_at_[hidden])
Date: 2007-10-12 13:16:07


On Fri, 12 Oct 2007 08:56:50 +0200, Marco Costalba <mcostalba_at_[hidden]>
wrote:

> On 10/12/07, Marco Costalba <mcostalba_at_[hidden]> wrote:
>>
>> So I would say a _possible_ policy is to not allow to register say
>>
>> set(f6);
>>
>> if is already registered a function with a "compatible" signature.
>>
>
> This is wrong.
>
> I would have said:
>
> " a _possible_ policy is that a call like
>
> f.set(f6);
>
> overwrites any exsisting function with the same signature *or with a
> compatible signature*"

Not sure to have understood your question.
Anyway this is the assignment policy followed by the latest version
of my implementation:
http://archives.free.net.ph/message/20071011.214216.2c194f99.en.html

Let be "ov" an instantiation of the overload template class for
a given set of signatures "ss" used as template arguments:
- if the passed functor "f" is a free function or a member function
   then:
   - if "f" is not overloaded and its signature is included in "ss"
     then the new target (i.e. "f") overwrites the target related
     to the matching signature;
   - if the signature of "f" is not included in "ss" a compile time
     error is produced;
   - if "f" is overloaded an "unresolved overloaded function type"
     compile time error is produced; (we can't rely on the Mesonides'
     trick, or equivalent for free functions, because they require
     to know the function name in advance); this is the same behaviour
     followed by boost.function;
   note: when I say that a function member signature is included in
         "ss" I actually mean that the signature of it's `equivalent`
         free function is included in "ss";
- if the passed functor "f" is a function object (possibly overloaded
   or polymorfic) then:
   - let be "rs" the set of signatures that are defined by its overload
     resolution set (or it would be better to say "by the overload
     resolution set of f::operator()" ); note that for a polymorfic
     object function "rs" is an infinite set;
   - if the intersection between "rs" and "ss" is empty the assignment
     fails and a compile time error is produced;
   - if the intersection between "rs" and "ss" is not empty then the new
     target (i.e. "f") overwrites all the targets related to the
     signatures included in the intersection.

I hope to have answered to your question.

Regards,
Marco

-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

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