|
Boost : |
Subject: Re: [boost] Formal Review Request: TypeErasure
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2012-05-24 22:16:45
AMDG
On 05/24/2012 04:21 PM, Jeremy Maitin-Shepard wrote:
> Steven Watanabe <watanabesj <at> gmail.com> writes:
>
>>
>> I'd like to request a formal review of the
>> TypeErasure library that I've posted about
>> several times before here.
>>
>> The TypeErasure library is a generalization
>> of boost::any and boost::function. It
>> allows easy composition of arbitrary
>> type erased operators.
>
> This library is indeed very interesting. From a quick look at some of the
> documentation, I have just one initial comment: I believe it is a mistake to
> "propagate constness" for "any"s that capture references, as that is
> inconsistent with normal C++ semantics and it leads to a situation of trying to
> fight the C++ type system rather than work with it.
>
The situation is one that isn't even
allowed with C++ references:
int & const ref = i; // error
The problem with
const any<Concept, _self&> xx;
is that anything that isn't specially
designed to handle it will see the
const and treat it as const. Some
parts of the library will work with
it, but in others it was just too
difficult.
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