D-Programming-Language/phobos — pull request #468 by stonemaster (2012-02-29 20:36:24+00:00)
Title: std.variant: Implement applyVisitor and applyDelegate

applyVisitor allows to apply a visitor to the given Algebraic depending
on its held type. It works like boost::apply_visitor of Boost.Variant.
A visitor is specified as a structure
or class which implements opCall overloads for each supported type of the
Algebraic. The function statically ensures that all types are handled by the
visitor.

applyDelegate works like applyVisitor but allows to specfiy the visiting
functions as delegates or static functions. Static checks ensure that
all types are handled and only allowed delegates are passed to the function.