Boost logo

Boost :

From: dan marsden (danmarsden_at_[hidden])
Date: 2006-05-08 13:49:02


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


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk