您正在查看Boost 1.36的文档,它是
released in 2008
. 如果你看看
documentation for the current release
,它列出了以下内容
apply_visitor
过载
template<typename MultiVisitor, typename Variant1, typename Variant2,
typename Variant3>
typename MultiVisitor::result_type OR decltype(auto)
apply_visitor(MultiVisitor & visitor, Variant1 & operand1,
Variant2 & operand2, Variant3 & operand3, ... other_operands);
template<typename MultiVisitor, typename Variant1, typename Variant2,
typename Variant3>
typename MultiVisitor::result_type OR decltype(auto)
apply_visitor(const MultiVisitor & visitor, Variant1 & operand1,
Variant2 & operand2, Variant3 & operand3, ... other_operands);
这些函数实际上是在标题中定义的
boost/variant/multivisitors.hpp
如果要使用多个访问者,则必须手动包含该标题。
operator()
3参数示例的重载,您的代码应该编译。