I should point out, just so that no-one is missing the obvious
here, that you'd be using static polymorphism through the use of
template functions whenever it's possible, i.e. when you don't
need to store polymorphic types.
So, you'd do this:
template <typename S>
auto func(const S& shape)
-> typename std::enable_if<
is_shape<S>::value
::type
{
// ...
}
You would NOT do this:
void func(const Shape& shape)
{
// ...
}
The big question is then: is the code bloat introduced by the
massive use of template functions worth the speed gained through
static polymorphism (vs. dynamic). Whether it is or not, the main
gain for me is in de-coupling of types, which helps in writing
truly generic code.