Hello,
I have a library with an abstract base class ABC and derived classes D1...
Dn.
These classes cannot be changed.
User code wants to write code that depends on which concrete type the object
being passed.
User writes:
void f( const ABC& abc )
{
Tag t = abc.GetTag() ; // Tag is an enum for all the derived types,
delivered by the lib
Switch (t)
{ case:
case:
case:
}
}
/// SO ugly, nevertheless if some case is missing, g++ for e.g. prints
warnings
I am told this is the visitor pattern
I then looked at boost::variant<>
The lib could deliver
typedef boost::variant