Subject: Re: [boost] Review of a safer memory management approach for C++?
From: Scott McMurray (me22.ca+boost_at_[hidden])
Date: 2010-06-04 14:33:34


On 4 June 2010 12:40, Bartlett, Roscoe A <rabartl_at_[hidden]> wrote:
>
> Okay, the runtime vs. compile-time polymorphism debate is another issue (but a very important one).
>

You can split the polymorphism situations into 2 types:

1) Those with consistent types and
2) Those that require different types

For (2), runtime polymorphism doesn't work. For (1), it can be coded
as static polymorphism, then a single type erasure layer can be easily
written (with an abstract base "interface" class and an
"implementation" class template) that adapts the static classes for
dynamic polymorphism.

So why wouldn't I just write everything as static, then apply the
erasure layer at the level appropriate for my application, if needed?