Boost fusion: Bug in sample?

Warning: MPL noob, still waiting for my book to arrive I'm reading the fusion library's documentation that was in the zip file for the announcement. If this is outdated, please ignore this email. The section in the quickstart: Print Only Pointers =================== Let's get a little cleverer. Say we wish to write a generic function that takes in an arbitrary sequence and XML prints only those elements which are pointers. Ah, easy. First, let's include the is_pointer boost type trait: #include <boost/type_traits/is_pointer.hpp> Then, simply: template <typename Sequence> void xml_print_pointers(Sequence const& seq) { for_each(filter_if<boost::is_pointer<Sequence> >(seq), print_xml()); } ==================== This doesn't seem to compile as is. I needed to do the following instead of the above: template <typename Sequence> void xml_print_pointers(Sequence const& seq) { using namespace mpl::placeholders; typedef mpl::lambda<boost::is_pointer<_1> >::type is_pointer; fusion::for_each(fusion::filter_if<is_pointer>(seq), print_xml()); } This is using boost 1.33.1. Did I miss something? Thanks! Sohail

Sohail Somani wrote:
Warning: MPL noob, still waiting for my book to arrive
I'm reading the fusion library's documentation that was in the zip file for the announcement. If this is outdated, please ignore this email.
It is outdated. It's been fixed in the CVS.
for_each(filter_if<boost::is_pointer<Sequence> >(seq), print_xml());
Doc typo.
typedef mpl::lambda<boost::is_pointer<_1> >::type is_pointer; fusion::for_each(fusion::filter_if<is_pointer>(seq), print_xml());
Better yet (see docs in CVS): for_each(filter_if<boost::is_pointer<_> >(seq), print_xml()); HTH. Regards, -- Joel de Guzman http://www.boost-consulting.com http://spirit.sf.net

-----Original Message----- From: boost-users-bounces@lists.boost.org on behalf of Joel de Guzman Better yet (see docs in CVS): for_each(filter_if<boost::is_pointer<_> >(seq), print_xml()); === Thanks, I'll be looking at CVS instead then (didn't realize it would be in there). Which version of boost is this library going to be released with?

Sohail Somani wrote:
-----Original Message----- From: boost-users-bounces@lists.boost.org on behalf of Joel de Guzman
Better yet (see docs in CVS):
for_each(filter_if<boost::is_pointer<_> >(seq), print_xml());
===
Thanks, I'll be looking at CVS instead then (didn't realize it would be in there). Which version of boost is this library going to be released with?
1.35 is our best bet :) Regards, -- Joel de Guzman http://www.boost-consulting.com http://spirit.sf.net
participants (2)
-
Joel de Guzman
-
Sohail Somani