|
Boost : |
Subject: Re: [boost] Formal Review Request: TypeErasure
From: Dave Abrahams (dave_at_[hidden])
Date: 2012-06-07 19:47:01
on Thu Jun 07 2012, Steven Watanabe <watanabesj-AT-gmail.com> wrote:
> AMDG
>
> On 06/07/2012 01:27 PM, Dave Abrahams wrote:
>>
>> on Thu Jun 07 2012, Nevin Liber <nevin-AT-eviloverlord.com> wrote:
>>
>>> On 7 June 2012 13:41, Dave Abrahams <dave_at_[hidden]> wrote:
>>>
>>>>
>>>> In a nutshell, concept-based-runtime-polymorphism/type-erasure allows
>>>> you to have runtime polymorphism while preserving value semantics. The
>>>> value of that win is very commonly underestimated.
>>>>
>>>
>>> +1
>>>
>>> So, is there a language feature that could be added to C++17 that would
>>> make implementing type erasure easier?
>>
>> Yes; concepts :-)
>>
>
> I don't see how concepts would help.
> Concepts would allow you to check the
> requirements, but I don't think there's
> any way to build a vtable from a concept
> definition.
Not in a library, maybe, but concepts would lay the groundwork for the
necessary language feature; I think it could be a very small extension
on top of concepts.
-- Dave Abrahams BoostPro Computing http://www.boostpro.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk