From: Maarten Kronenburg (M.Kronenburg_at_[hidden])
Date: 2006-05-27 08:52:35
Here is my personal view on how I see
compile-time and run-time polymorphism.
There is a scale between compile-time
polymorphism on the left and run-time
polymorphism on the right.
In my opinion containers and sort algorithms
are 100% compile-time polymorph:
the implementation remains identical,
but the interface must be flexible,
in this case meaning template parameters.
Drivers are 100% run-time polymorph:
the interface remains identical,
but the implementation is flexible,
in this case meaning an abstract class
where derivation is mandatory.
Now the string needs to be compile-time
polymorph (working with different character
sets), but already the implementation can
be a little bit flexible (different allocators).
The string is in my opinion left from the middle.
In my opinion the integer is right from the
middle: the implementations can use
different algorithms for multiplication,
and the users may change the implementation
for unsigned and modular variants.
In this case meaning derivation is an option
but not mandatory.
So from the left (compile-time polymorph)
to the right (run-time polymorph) we have:
containers, strings, integers, drivers.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk