Extend the runtime polymorphism to vistor like pattern...
namespace playrho {
template <>
void Visit(const d2::EdgeShapeConf& shape, void* userData)
{
const auto shapeDrawer = static_cast<ShapeDrawer*>(userData);
shapeDrawer->Visit(shape);
}
This provides application based visitation with userData
providing some customization (based on the capability/flexibility of ShapeDrawer
) at the point of calling the Visit
function on the Shape
. Can we do "better" than ShapeDrawer
? Can we elegantly have userData
pull in a completely configurable lambda per the given class (d2::EdgeShapeConf
for instance)?