Class template apply_visitor_delayed_t

boost::apply_visitor_delayed_t — Adapts a visitor for use as a function object.


Synopsis

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 &);
};

Description

Adapts the function given at construction for use as a function object. This is useful, for example, 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 construct/copy/destruct

  1. explicit apply_visitor_delayed_t(Visitor & visitor);
    Effects: Constructs the function object with the given visitor.

apply_visitor_delayed_t function object interface

  1. template<typename Variant> result_type operator()(Variant & operand);
    template<typename Variant1, typename Variant2> 
      result_type operator()(Variant1 & operand1, Variant2 & operand2);

    Invokes apply_visitor on the stored visitor using the given operands.


Copyright © 2002, 2003 Eric Friedman, Itay Maman
Permission to copy, use, sell and distribute this software is granted provided this copyright notice appears in all copies. Permission to modify the code and to distribute modified code is granted provided this copyright notice appears in all copies, and a notice that the code was modified is included with the copyright notice. This software is provided "as is" without express or implied warranty, and with no claim as to its suitability for any purpose.

Top