Boost logo

Boost Users :

Subject: [Boost-users] [variant] newbie Q: cannot visit variant variable: "no matching function for call to apply_visitor ..."
From: Riccardo Murri (riccardo.murri_at_[hidden])
Date: 2010-06-04 13:30:42


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)



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net