Adapts a visitor for use as a function object.

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.

See ``apply_visitor_delayed_cpp14_t`` which is used on C++14 compatible compilers when `Visitor` has no `result_type` typedef.

typename Visitor::result_type
Visitor &

Constructs the function object with the given visitor.

result_type `Variant&...`
result_type `Variant &`
result_type `Variant1 &` `Variant2 &`
Function call operator.

Invokes `apply_visitor` on the stored visitor using the given operands.

Version with variadic templates is used by default if BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES is not defined.
Adapts a visitor for use as a function object.

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.

See ``apply_visitor_delayed_t`` which is used when `Visitor` has `result_type` typedef.

Available only if macro BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES is not defined and compiler supports `decltype(auto)` and `decltype(some-expression)`.

Visitor &

Constructs the function object with the given visitor.

decltype(auto) `Variant&...`
Function call operator.

Invokes `apply_visitor` on the stored visitor using the given operands.

typename Visitor::result_type

Visitor &
Variant &
typename Visitor::result_type

const Visitor &
Variant &
typename BinaryVisitor::result_type OR decltype(auto)

BinaryVisitor &
Variant1 &
Variant2 &
typename BinaryVisitor::result_type OR decltype(auto)

const BinaryVisitor &
Variant1 &
Variant2 &
typename MultiVisitor::result_type OR decltype(auto)

MultiVisitor &
Variant1 &
Variant2 &
Variant3 &
...
typename MultiVisitor::result_type OR decltype(auto)

const MultiVisitor &
Variant1 &
Variant2 &
Variant3 &
...
`apply_visitor_delayed_t`<Visitor>

Visitor &
`apply_visitor_delayed_cpp14_t`<Visitor>

Visitor &

Allows compile-time checked type-safe application of the given visitor to the content of the given variant, ensuring that all types are handled by the visitor.

The behavior of `apply_visitor` is dependent on the number of arguments on which it operates (i.e., other than the visitor). The function behaves as follows:

- Overloads accepting one operand invoke the unary function call operator of the given visitor on the content of the given ``variant`` operand.
- Overloads accepting two operands invoke the binary function call operator of the given visitor on the content of the given ``variant`` operands.
- Overloads accepting three or more operands invoke the function call operator of the given visitor on the content of the given ``variant`` operands. Maximum amount of parameters controlled by `BOOST_VARAINT_MAX_MULTIVIZITOR_PARAMS` macro. Those functions are actually defined in a header `boost/variant/multivisitors.hpp` (See ). That header must be manually included if multi visitors are meant for use.
- The overloads accepting only a visitor return a `C++03 compatible generic function object` or `C++14 compatible generic function object` that accepts either one, two or arbitrary count of arguments and invoke `apply_visitor` using these arguments and `visitor`, thus behaving as specified above. (This behavior is particularly useful, for example, when one needs to operate on each element of a sequence of variant objects using a standard library algorithm.)

The overloads acccepting operands return the result of applying the given visitor to the content of the given operands. The overload accepting only a visitor return a function object, thus delaying application of the visitor to any operands.

The given visitor must fulfill the StaticVisitor concept requirements with respect to each of the bounded types of the given `variant`.

The overloads accepting operands throw only if the given visitor throws when applied. The overload accepting only a visitor will not throw. (Note, however, that the returned `function object` may throw when invoked.)