...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::apply_visitor_delayed_t — Adapts a visitor for use as a function object.
// In header: <boost/variant/apply_visitor.hpp> template<typename Visitor> class apply_visitor_delayed_t { public: // types typedef typename Visitor::result_type result_type; // construct/copy/destruct explicit apply_visitor_delayed_t(Visitor &); // function object interface template<typename Variant> result_type operator()(Variant &); template<typename Variant1, typename Variant2> result_type operator()(Variant1 &, Variant2 &); };
Adapts the function given at construction for use as a
function object. This is useful, for example, when one needs to
operate on each element of a sequence of variant objects using a
standard library algorithm such as
std::for_each
.
See the "visitor-only" form of
apply_visitor
for a simple
way to create apply_visitor_delayed_t
objects.
apply_visitor_delayed_t
function object interfacetemplate<typename Variant> result_type operator()(Variant & operand); template<typename Variant1, typename Variant2> result_type operator()(Variant1 & operand1, Variant2 & operand2);Function call operator.
Invokes
apply_visitor
on the
stored visitor using the given operands.