c++ - Boost variant get fail -
i have such code:
boost::variant<b2distancejointdef, b2frictionjointdef, b2gearjointdef, b2mousejointdef, b2prismaticjointdef, b2pulleyjointdef, b2revolutejointdef, b2ropejointdef, b2weldjointdef, b2wheeljointdef> prmjointdef; b2distancejointdef &prmdistacejointdef = boost::get<b2distancejointdef>(prmjointdef);
the error is:
source\scene\components\jointcomponent.cpp:51:96: error: no matching function call 'get(boost::variant<b2distancejointdef, b2frictionjointdef, b2gearjointdef, b2mousejointdef, b2prismaticjointdef, b2pulleyjointdef, b2revolutejointdef, b2ropejointdef, b2weldjointdef, b2wheeljointdef>&)' \source\scene\components\jointcomponent.cpp:51:96: note: candidates are: boost/optional/optional.hpp:626:30: note: template<class t> typename boost::optional::reference_const_type boost::get(const boost::optional<t>&) boost/optional/optional.hpp:634:24: note: template<class t> typename boost::optional::reference_type boost::get(boost::optional<t>&) boost/optional/optional.hpp:644:30: note: template<class t> typename boost::optional::pointer_const_type boost::get(const boost::optional<t>*) boost/optional/optional.hpp:652:24: note: template<class t> typename boost::optional::pointer_type boost::get(boost::optional<t>*)
whats wrong here?
the particular overload of get
boost.variant provides available through #include <boost/variant/get.hpp>
.
alternatively, boost/variant.hpp
provides if not of headers of boost.variant, wouldn't recommend outside of small toy programs. fine-grained headers nice have.
Comments
Post a Comment