[review][fusion] trouble with a small fusion program.

I based the program below on the Fusion docs, and it will not compile under powerpc-apple-darwin8-g++-4.0.0 (GCC) 4.0.0 20041026 (Apple Computer, Inc. build 4061). The error I get is: .../fusion/boost/fusion/sequence/view/filter_view/ filter_view_iterator.hpp:40: error: 'call' is not a member of 'boost::fusion::detail::static_find_if<boost::fusion::vector_iterator<co nst boost::fusion::vector<int*, char, std::string, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_>, 0>, boost::fusion::vector_iterator<const boost::fusion::vector<int*, char, std::string, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_>, 3>, boost::is_pointer<boost::fusion::vector<int*, char, std::string, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_, boost::fusion::void_> > >' Is there an obvious error in the program below? Thanks, ron ------------<snip>------------------ #include <boost/fusion/sequence.hpp> #include <boost/fusion/algorithm.hpp> #include <boost/type_traits/is_pointer.hpp> struct nop { template <typename T> void operator()(T const& x) const { } }; template <typename Sequence> void pointer_nop(Sequence const& seq) { using boost::fusion::filter_if; for_each(filter_if<boost::is_pointer<Sequence> >(seq), nop ()); /// <<------ Instantiation of this line triggers the error } int main() { using boost::fusion::vector; using boost::fusion::at_c; vector<int*,char,std::string> stuff(0,'x', "howdy"); pointer_nop(stuff); }

Ronald Garcia wrote:
Is there an obvious error in the program below?
The code below looks to be based on an example in the quick start guide, which has a typo in it that was picked up by one of the reviewers. The filter_if algorithm expects an MPL lambda expression as its predicate, so to fix the defect in the example: filter_if<boost::is_pointer<Sequence> >(seq) should be changed to: filter_if<boost::is_pointer<_> >(seq) The typo has now been fixed in the docs. Thanks Dan ------------<snip>------------------ #include <boost/fusion/sequence.hpp> #include <boost/fusion/algorithm.hpp> #include <boost/type_traits/is_pointer.hpp> struct nop { template <typename T> void operator()(T const& x) const { } }; template <typename Sequence> void pointer_nop(Sequence const& seq) { using boost::fusion::filter_if; for_each(filter_if<boost::is_pointer<Sequence> >(seq), nop ()); /// <<------ Instantiation of this line triggers the error } int main() { using boost::fusion::vector; using boost::fusion::at_c; vector<int*,char,std::string> stuff(0,'x', "howdy"); pointer_nop(stuff); } _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
participants (2)
-
dan marsden
-
Ronald Garcia