Boost logo

Boost :

Subject: Re: [boost] Formal Review Request: TypeErasure
From: Daniel Larimer (dlarimer_at_[hidden])
Date: 2012-06-12 01:11:02

On Jun 7, 2012, at 3:08 PM, Nevin Liber 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?

A language construct such that implemented special interpretation of the construct:

anytype concept_name x;

Or perhaps simply specify a concept type like any other type....

That would greatly improve compile times AND readability compared to the template hoops required to do what TypeErasure does.

In my opinion, just because something *can* be done with templates doesn't mean it should.

C++2x should embrace any feature that could reduce compile times to the same extent that variadic templates did for c++11.

I am not familiar with the 'concepts' feature that was dropped from C++0x, but if it increases compile times that that may not be a way to go.

Boost list run by bdawes at, gregod at, cpdaniel at, john at