
8 Jun
2012
8 Jun
'12
10:20 a.m.
On 07.06.2012 21:08, Nevin Liber wrote:
On 7 June 2012 13:41, Dave Abrahams<dave@boostpro.com> 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? Compile-time reflection and declaration-injection.
struct S { void one(); void two(); }; any<S> anyS = FooThatLooksLikeS(); The any template would inspect the declarations of S and inject its own type-erased implementation of the same. Sebastian