boost::visitor_ptr_t — Adapts a function pointer for use as a static visitor.
template<typename T, typename R> class visitor_ptr_t : public static_visitor<R> { public: // construct/copy/destruct explicit visitor_ptr_t(R (*)(T)); // static visitor interfaces R operator()(unspecified-forwarding-type); template<typename U> void operator()(const U&); };
Adapts the function given at construction for use as a static visitor of type T with result type R.
Effects: | If passed a value or reference of type T, it invokes the function given at construction, appropriately forwarding operand. |
Returns: | Returns the result of the function invocation. |
Throws: | The overload taking a value or reference of type T throws if the invoked function throws. The overload taking all other values always throws bad_visit. |
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. |