|
Boost : |
Subject: Re: [boost] Formal Review Request: TypeErasure
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2012-06-30 18:20:40
AMDG
On 05/29/2012 03:04 AM, Dave Abrahams wrote:
>
> on Tue May 22 2012, Steven Watanabe <watanabesj-AT-gmail.com> wrote:
>
>>
>> Online documentation can be found here:
>> http://steven_watanabe.users.sourceforge.net/type_erasure/libs/type_erasure/
>
> http://steven_watanabe.users.sourceforge.net/type_erasure/libs/type_erasure/doc/html/boost_typeerasure/multi.html
> says:
>
> The types of the arguments must match or the behavior is undefined.
>
> I presume you mean that the dynamic, erased types must match?
> (presumably you could easily prevent the use of different static types at
> compile-time). IMO it's crucial that you be rigorous about these
> distinctions in your documentation.
>
I've tried to clarify this.
> I wonder if undefined behavior is really the best possible choice here.
> I honestly don't know what's most useful. Do you have a rationale for
> your choice?
>
It's impossible to enforce this statically,
so the only alternative is to throw an
exception. I do provide a mode that does
this. By default the library assumes that
you've made sure that the types match.
If you add relaxed_match, it will check
whether the arguments match and if they
don't, either fall back on some reasonable
default behavior or throw.
In Christ,
Steven Watanabe
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk