[variant] newbie Q: cannot visit variant variable: "no matching function for call to apply_visitor ..."
Hello, I'm getting the following error when I try to compile the attached C++ source (repetitions of "boost::detail::variant::void_" omitted for clarity):: $ g++ variant_no_matching_function_call.cc variant_no_matching_function_call.cc: In member function ‘size_t Waterfall::Processor::step()::_row_size::operator()(boost::variant<Waterfall::Processor::SparseRow*, Waterfall::Processor::DenseRow*, boost::detail::variant::void_, ..., boost::detail::variant::void_>&)’: variant_no_matching_function_call.cc:47: error: no matching function for call to ‘apply_visitor(Waterfall::Processor::step()::__row_size, boost::variant<Waterfall::Processor::SparseRow*, Waterfall::Processor::DenseRow*, boost::detail::variant::void_, ..., boost::detail::variant::void_>&)’ I'm aware that the attached sample could be better handled by simple polymorphism, but it is the shortest excerpt from my real code that reproduces the problem. I'm getting the same error each time I try to "apply_visitor", so there must be something wrong in the way I'm using it... Thank you very much for any suggestions! I'm using g++ 4.4 and Boost.Variant 1.40 from the native Ubuntu 10.04 packages. Best regards, Riccardo -- Riccardo Murri, Hadlaubstr. 150, 8006 Zürich (CH)
AMDG Riccardo Murri wrote:
I'm getting the following error when I try to compile the attached C++ source (repetitions of "boost::detail::variant::void_" omitted for clarity)::
A local class cannot be used as a template argument. In Christ, Steven Watanabe
On Fri, Jun 4, 2010 at 8:08 PM, Steven Watanabe <watanabesj@gmail.com> wrote:
Riccardo Murri wrote:
I'm getting the following error when I try to compile the attached C++ source (repetitions of "boost::detail::variant::void_" omitted for clarity)::
A local class cannot be used as a template argument.
Thanks Steven! Riccardo
participants (2)
-
Riccardo Murri
-
Steven Watanabe