
Hi, I'm having trouble getting make_filter_iterator and bind to work together nicely: ------------------------------------------------------------------------------- boost::function<bool (const node_type&)> is_constraint; is_constraint = boost::bind(&node_type::IsConstraint, _1); boost::make_filter_iterator(is_constraint, ab.begin(), ab.end()); // ERROR: does not compile boost::make_filter_iterator(boost::bind(&node_type::IsConstraint, _1), ab.begin(), ab.end()); // compiles ------------------------------------------------------------------------------- Note that ab.begin()/ab.end() return iterators to containers of shared pointers. See below for compiler errors. What I would like to do, in the end, is something like this: ------------------------------------------------------------------------------- typedef boost::filter_iterator<boost::function<bool (const node_type&)>, articulated_model_type::node_df_traversal_iterator> joint_iterator; joint_iterator first = boost::make_filter_iterator(boost::bind(&node_type::IsConstraint, _1), ab.begin(), ab.end()); ------------------------------------------------------------------------------- Unfortunately, this doesn't compile either. I want an explicit handle to the interator (first), because I'd like to do a normal for loop like this: for(joint_iterator joint = first; joint != last; ++joint) { ... } Again, compile errors are below. Thanks for the help. --nico d:\dev\boost_1_33_1\boost\iterator\filter_iterator.hpp(100) : error C2664: 'boost::function1<R,T0,Allocator>::result_type boost::function1<R,T0,Allocator>::operator ()(T0) const' : cannot convert parameter 1 from 'Hybrid::Graph<node_traits>::const_node_ptr' to 'const Hybrid::Node<graph_type_,node_traits> ' with [ R=bool, T0=const Hybrid::Node<Hybrid::Graph<ArticulatedModelNodeTraits<MyTypes>>::graph_type,ArticulatedModelNodeTraits<MyTypes>> , Allocator=std::allocator<void> ] and [ node_traits=ArticulatedModelNodeTraits<MyTypes> ] and [ graph_type_=Hybrid::Graph<ArticulatedModelNodeTraits<MyTypes>>::graph_type, node_traits=ArticulatedModelNodeTraits<MyTypes> ] Reason: cannot convert from 'Hybrid::Graph<node_traits>::const_node_ptr' to 'const node_type' with [ node_traits=ArticulatedModelNodeTraits<MyTypes> ] No constructor could take the source type, or constructor overload resolution was ambiguous d:\dev\boost_1_33_1\boost\iterator\filter_iterator.hpp(99) : while compiling class-template member function 'void boost::filter_iterator<Predicate,Iterator>::satisfy_predicate(void)' with [ Predicate=boost::function<bool (const node_type &)>, Iterator=Hybrid::Graph<ArticulatedModelNodeTraits<MyTypes>>::node_df_traversal_iterator ] d:\dev\Hybrid\Tests\Graph\main.cpp(645) : see reference to class template instantiation 'boost::filter_iterator<Predicate,Iterator>' being compiled with [ Predicate=boost::function<bool (const node_type &)>, Iterator=Hybrid::Graph<ArticulatedModelNodeTraits<MyTypes>>::node_df_traversal_iterator ] ====================================================================================== :\dev\Hybrid\Tests\Graph\main.cpp(646) : error C2440: 'initializing' : cannot convert from 'boost::filter_iterator<Predicate,Iterator>' to 'boost::filter_iterator<Predicate,Iterator>' with [ Predicate=boost::_bi::bind_t<bool,boost::_mfi::cmf0<bool,ConstraintNodeTraits>,boost::_bi::list1<boost::_bi::list_av_1<boost::arg<1>>::B1>>, Iterator=Hybrid::Graph<ArticulatedModelNodeTraits<MyTypes>>::node_df_traversal_iterator ] and [ Predicate=boost::function<bool (const node_type &)>, Iterator=Hybrid::Graph<ArticulatedModelNodeTraits<MyTypes>>::node_df_traversal_iterator ] No constructor could take the source type, or constructor overload resolution was ambiguous -- nico galoppo von borries @ address: 105 creel st., chapel hill comp. graphics phd. student @ north carolina, 27516 USA UNC, chapel hill @ phone: +1 (919) 962-1898 (office) @ +1 (919) 942-7609 (home) @ email: nico at cs dot unc dot edu @ homepage: http://www.cs.unc.edu/~nico --- debian linux :: vim powered

Nico Galoppo <nico@crossbar.net> writes:
I'm having trouble getting make_filter_iterator and bind to work together nicely:
------------------------------------------------------------------------------- boost::function<bool (const node_type&)> is_constraint; is_constraint = boost::bind(&node_type::IsConstraint, _1);
boost::make_filter_iterator(is_constraint, ab.begin(), ab.end()); // ERROR: does not compile boost::make_filter_iterator(boost::bind(&node_type::IsConstraint, _1), ab.begin(), ab.end()); // compiles -------------------------------------------------------------------------------
Note that ab.begin()/ab.end() return iterators to containers of shared pointers. See below for compiler errors.
It's actually not bind, but function. Bind contains magic that treats shared_ptr<T> and T& the same way, but for function to take advantage of that magic, you need to make sure its argument type is shared_ptr<T>, not T&: boost::function<bool (shared_ptr<node_type const>)> is_constraint = boost::bind(&node_type::IsConstraint, _1); boost::make_filter_iterator(is_constraint, ab.begin(), ab.end()); The hint is right here:
Reason: cannot convert from 'Hybrid::Graph<node_traits>::const_node_ptr' to 'const node_type' with [ node_traits=ArticulatedModelNodeTraits<MyTypes> ]
HTH, -- Dave Abrahams Boost Consulting www.boost-consulting.com

David Abrahams wrote:
I'm having trouble getting make_filter_iterator and bind to work together nicely:
------------------------------------------------------------------------------- boost::function<bool (const node_type&)> is_constraint; is_constraint = boost::bind(&node_type::IsConstraint, _1);
boost::make_filter_iterator(is_constraint, ab.begin(), ab.end()); // ERROR: does not compile boost::make_filter_iterator(boost::bind(&node_type::IsConstraint, _1), ab.begin(), ab.end()); // compiles -------------------------------------------------------------------------------
Note that ab.begin()/ab.end() return iterators to containers of shared pointers. See below for compiler errors.
It's actually not bind, but function. Bind contains magic that treats shared_ptr<T> and T& the same way, but for function to take advantage of that magic, you need to make sure its argument type is shared_ptr<T>, not T&:
boost::function<bool (shared_ptr<node_type const>)> is_constraint = boost::bind(&node_type::IsConstraint, _1);
boost::make_filter_iterator(is_constraint, ab.begin(), ab.end());
Thanks, that works like a charm. Unfortunately, dereferencing the created iterator gives more trouble: boost::function<bool (shared_ptr<node_type const>)> is_constraint = boost::bind(&node_type::IsConstraint, _1); typedef boost::filter_iterator<boost::function<bool (shared_ptr<node_type const>)>, articulated_model_type::node_df_traversal_iterator> joint_node_iterator; joint_node_iterator jointnode = boost::make_filter_iterator(is_constraint, ab.begin(), ab.end()); std::cout << jointnode->Model(); ///< this line fails to compile There seems to be a problem with const-ness (see below). Thanks again. --nico ------------------------------------------------------------------------------ d:\dev\boost_1_33_1\boost\iterator\iterator_adaptor.hpp(307) : error C2440: 'return' : cannot convert from 'Hybrid::Graph<node_traits>::const_node_ptr' to 'boost::iterator_facade<Derived,Value,CategoryOrTraversal,Reference,Difference>::reference' with [ node_traits=Hybrid::ArticulatedModelNodeTraits<MyTypes> ] and [ Derived=boost::filter_iterator<boost::function<bool (boost::shared_ptr<const Hybrid::Graph<Hybrid::ArticulatedModelNodeTraits<MyTypes>>::node_type>)>,Hybrid::Graph<Hybrid::ArticulatedModelNodeTraits<MyTypes>>::node_df_traversal_iterator>, Value=boost::iterator_value<Hybrid::Graph<Hybrid::ArticulatedModelNodeTraits<MyTypes>>::node_df_traversal_iterator>::type, CategoryOrTraversal=boost::mpl::identity<boost::forward_traversal_tag>::type, Reference=boost::iterator_reference<Hybrid::Graph<Hybrid::ArticulatedModelNodeTraits<MyTypes>>::node_df_traversal_iterator>::type, Difference=boost::iterator_difference<Hybrid::Graph<Hybrid::ArticulatedModelNodeTraits<MyTypes>>::node_df_traversal_iterator>::type ] A reference that is not to 'const' cannot be bound to a non-lvalue d:\dev\boost_1_33_1\boost\iterator\iterator_adaptor.hpp(307) : while compiling class-template member function 'boost::iterator_facade<Derived,Value,CategoryOrTraversal,Reference,Difference>::reference boost::iterator_adaptor<Derived,Base,boost::use_default,Traversal>::dereference(void) const' with [ Derived=boost::filter_iterator<boost::function<bool (boost::shared_ptr<const Hybrid::Graph<Hybrid::ArticulatedModelNodeTraits<MyTypes>>::node_type>)>,Hybrid::Graph<Hybrid::ArticulatedModelNodeTraits<MyTypes>>::node_df_traversal_iterator>, Value=boost::iterator_value<Hybrid::Graph<Hybrid::ArticulatedModelNodeTraits<MyTypes>>::node_df_traversal_iterator>::type, CategoryOrTraversal=boost::mpl::identity<boost::forward_traversal_tag>::type, Reference=boost::iterator_reference<Hybrid::Graph<Hybrid::ArticulatedModelNodeTraits<MyTypes>>::node_df_traversal_iterator>::type, Difference=boost::iterator_difference<Hybrid::Graph<Hybrid::ArticulatedModelNodeTraits<MyTypes>>::node_df_traversal_iterator>::type, Base=Hybrid::Graph<Hybrid::ArticulatedModelNodeTraits<MyTypes>>::node_df_traversal_iterator, Traversal=boost::mpl::if_<boost::is_convertible<boost::mpl::identity<boost::forward_traversal_tag>::type,boost::random_access_traversal_tag>,boost::bidirectional_traversal_tag,boost::use_default>::type ] d:\dev\boost_1_33_1\boost\iterator\filter_iterator.hpp(46) : see reference to class template instantiation 'boost::iterator_adaptor<Derived,Base,Value,Traversal>' being compiled with [ Derived=boost::filter_iterator<boost::function<bool (boost::shared_ptr<const Hybrid::Graph<Hybrid::ArticulatedModelNodeTraits<MyTypes>>::node_type>)>,Hybrid::Graph<Hybrid::ArticulatedModelNodeTraits<MyTypes>>::node_df_traversal_iterator>, Base=Hybrid::Graph<Hybrid::ArticulatedModelNodeTraits<MyTypes>>::node_df_traversal_ iterator, Value=boost::use_default, Traversal=boost::mpl::if_<boost::is_convertible<boost::mpl::identity<boost::forward_traversal_tag>::type,boost::random_access_traversal_tag>,boost::bidirectional_traversal_tag,boost::use_default>::type ] d:\dev\Hybrid\Tests\Graph\main.cpp(398) : see reference to class template instantiation 'boost::filter_iterator<Predicate,Iterator>' being compiled with [ Predicate=boost::function<bool (boost::shared_ptr<const Hybrid::Graph<Hybrid::ArticulatedModelNodeTraits<MyTypes>>::node_type>)>, Iterator=Hybrid::Graph<Hybrid::ArticulatedModelNodeTraits<MyTypes>>::node_df_traversal_iterator ] -- nico galoppo von borries @ address: 105 creel st., chapel hill comp. graphics phd. student @ north carolina, 27516 USA UNC, chapel hill @ phone: +1 (919) 962-1898 (office) @ +1 (919) 942-7609 (home) @ email: nico at cs dot unc dot edu @ homepage: http://www.cs.unc.edu/~nico --- debian linux :: vim powered

Nico Galoppo <nico@crossbar.net> writes:
Thanks, that works like a charm. Unfortunately, dereferencing the created iterator gives more trouble:
boost::function<bool (shared_ptr<node_type const>)> is_constraint = boost::bind(&node_type::IsConstraint, _1); typedef boost::filter_iterator<boost::function<bool (shared_ptr<node_type const>)>, articulated_model_type::node_df_traversal_iterator> joint_node_iterator;
joint_node_iterator jointnode = boost::make_filter_iterator(is_constraint, ab.begin(), ab.end());
std::cout << jointnode->Model(); ///< this line fails to compile
There seems to be a problem with const-ness (see below).
It's not a constness problem, exactly. The problem is that the result of *ab.begin() is an rvalue (i.e. returned by value, not by reference). Yet the filter_iterator thinks it is iterating over lvalues: its reference type is Hybrid::Graph<node_traits>::const_node_ptr&, and the compiler is complaining that you can't initialize such a reference with a non-lvalue. It's hard to come up with a complete analysis with the little information I have here, but I believe Hybrid::Graph<Hybrid::ArticulatedModelNodeTraits<MyTypes> >::node_df_traversal_iterator is misreporting its reference type or its category. An iterator whose operator* returns by value cannot be a forward iterator; it can only be an input iterator. -- Dave Abrahams Boost Consulting www.boost-consulting.com

David Abrahams wrote:
It's not a constness problem, exactly. The problem is that the result of
*ab.begin()
is an rvalue (i.e. returned by value, not by reference). Yet the filter_iterator thinks it is iterating over lvalues: its reference type is Hybrid::Graph<node_traits>::const_node_ptr&, and the compiler is complaining that you can't initialize such a reference with a non-lvalue. It's hard to come up with a complete analysis with the little information I have here, but I believe
Hybrid::Graph<Hybrid::ArticulatedModelNodeTraits<MyTypes> ::node_df_traversal_iterator
is misreporting its reference type or its category. An iterator whose operator* returns by value cannot be a forward iterator; it can only be an input iterator.
I must admit, I'm only a novice at writing my own iterators. I've given it a try (see below), but something must be doing something wrong as you said. I think operator*() returns a reference now, but I could be wrong. ------------------------------------------------------------------------------- class node_df_traversal_iterator : public std::iterator<std::forward_iterator_tag,node_type> { protected: node_ptr m_node; ///< Current node being visited in traversal. node_ptr_container m_queue; ///< Remaining unvisited nodes in traversal. public: node_df_traversal_iterator(node_ptr node) : m_node(node) { if(node) m_queue.push_back(node); } bool operator== ( node_df_traversal_iterator const & other ) const{ return (other.m_node==m_node); } bool operator!= ( node_df_traversal_iterator const & other ) const{ return !((*this)==other); } node_type & operator*() {return (*m_node);} node_ptr operator->() {return m_node;} node_type const & operator*() const {return (*m_node);} const_node_ptr operator->()const {return const_node_ptr(m_node);} node_df_traversal_iterator & operator++() { if(m_queue.empty()) { m_node.reset(); return (*this); } m_queue.pop_front(); node_ptr_iterator begin = m_node->child_ptr_begin(); node_ptr_iterator end = m_node->child_ptr_end(); for(node_ptr_iterator child = begin; child != end; ++child ) m_queue.push_front( *child ); // depth first if(m_queue.empty()) { m_node.reset(); } else m_node = m_queue.front(); return (*this); } }; node_df_traversal_iterator begin() { return node_df_traversal_iterator(m_root); } node_df_traversal_iterator end() { return node_df_traversal_iterator( node_ptr() ); } const node_df_traversal_iterator begin() const { node_ptr root = boost::const_pointer_cast<node_type>(m_root); return node_df_traversal_iterator(root); } const node_df_traversal_iterator end() const { return node_df_traversal_iterator( node_ptr() ); } -- nico galoppo von borries @ address: 105 creel st., chapel hill comp. graphics phd. student @ north carolina, 27516 USA UNC, chapel hill @ phone: +1 (919) 962-1898 (office) @ +1 (919) 942-7609 (home) @ email: nico at cs dot unc dot edu @ homepage: http://www.cs.unc.edu/~nico --- debian linux :: vim powered

Nico Galoppo <nico@crossbar.net> writes:
David Abrahams wrote:
It's not a constness problem, exactly. The problem is that the result of
*ab.begin()
is an rvalue (i.e. returned by value, not by reference). Yet the filter_iterator thinks it is iterating over lvalues: its reference type is Hybrid::Graph<node_traits>::const_node_ptr&, and the compiler is complaining that you can't initialize such a reference with a non-lvalue. It's hard to come up with a complete analysis with the little information I have here, but I believe
Hybrid::Graph<Hybrid::ArticulatedModelNodeTraits<MyTypes> ::node_df_traversal_iterator
is misreporting its reference type or its category. An iterator whose operator* returns by value cannot be a forward iterator; it can only be an input iterator.
I must admit, I'm only a novice at writing my own iterators. I've given it a try (see below), but something must be doing something wrong as you said.
Novices should not write their own iterators without the help of boost::iterator_facade or iterator_adaptor. There are too many ways to get it wrong.
I think operator*() returns a reference now, but I could be wrong.
"Now" meaning you juste fixed it, or has it always been returning a reference? BTW, I also wonder if building your own graph classes is the best course of action when Boost provides a Graph library.
-------------------------------------------------------------------------------
class node_df_traversal_iterator : public std::iterator<std::forward_iterator_tag,node_type> { protected:
node_ptr m_node; ///< Current node being visited in traversal. node_ptr_container m_queue; ///< Remaining unvisited nodes in traversal.
public:
node_df_traversal_iterator(node_ptr node) : m_node(node) { if(node) m_queue.push_back(node); }
bool operator== ( node_df_traversal_iterator const & other ) const{ return (other.m_node==m_node); } bool operator!= ( node_df_traversal_iterator const & other ) const{ return !((*this)==other); } node_type & operator*() {return (*m_node);}
Yep, looks like a reference.
node_ptr operator->() {return m_node;} node_type const & operator*() const {return (*m_node);}
This is where your problem is. The const-ness of an iterator should never affect the constness of the elements it traverses. I suggest, strongly, that you go through the tutorial at http://www.boost.org/libs/iterator/doc/iterator_facade.html#tutorial-example and build your iterators around that. HTH, -- Dave Abrahams Boost Consulting www.boost-consulting.com

David Abrahams wrote:
I suggest, strongly, that you go through the tutorial at
http://www.boost.org/libs/iterator/doc/iterator_facade.html#tutorial-example
and build your iterators around that.
Wow, that tutorial was really helpful. I rewrote my iterators using iterator_facade<>, it was a breeze. Thanks! --nico -- nico galoppo von borries @ address: 105 creel st., chapel hill comp. graphics phd. student @ north carolina, 27516 USA UNC, chapel hill @ phone: +1 (919) 962-1898 (office) @ +1 (919) 942-7609 (home) @ email: nico at cs dot unc dot edu @ homepage: http://www.cs.unc.edu/~nico --- debian linux :: vim powered

I have the following code which copy items if certain condition is met: copy_if(a.begin(), a.end(), back_inserter(b), bind( &::feq<float>, _1, max)) ); How can I reverse the logic of that? how can I call std::not1() in the boost lambda bind library? __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com

yinglcs2@yahoo.com wrote:
I have the following code which copy items if certain condition is met:
copy_if(a.begin(), a.end(), back_inserter(b), bind( &::feq<float>, _1, max)) );
How can I reverse the logic of that? how can I call std::not1() in the boost lambda bind library?
copy_if( a.begin() , a.end() , back_inserter(b) , !bind( &::feq<float>, _1, max ) ); Should do it, at least with 1.33.1, if that's what you mean by 'reverse the logic'. Jeff Flinn

yinglcs2@yahoo.com wrote:
I have the following code which copy items if certain condition is met:
copy_if(a.begin(), a.end(), back_inserter(b), bind( &::feq<float>, _1, max)) );
How can I reverse the logic of that?
Use !bind( &::feq<float>, _1, max )

I have a for loop which pass the map.second to a function, like this: class A; typedef map<int, A*> MyMap; sortY(A& a); for (MyMap::iterator iter = map.begin(); iter != map.end(); ++iter) { A *a = (*iter).second; sortY(*a); } how can I translate the above for() loop into for_each and use boost lambda? __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com

yinglcs2@yahoo.com wrote:
I have a for loop which pass the map.second to a function, like this: class A; typedef map<int, A*> MyMap;
sortY(A& a);
for (MyMap::iterator iter = map.begin(); iter != map.end(); ++iter) { A *a = (*iter).second;
sortY(*a); }
how can I translate the above for() loop into for_each and use boost lambda?
I didn't test the following, but it should work :) #include <boost/lambda/lambda.hpp> #include <boost/lambda/bind.hpp> using boost::lambda::_1; using boost::lambda::bind; std::for_each(map.begin(), map.end(), bind(&sortY, *bind(&MyMap::value_type::second, _1))); KevinH -- Kevin Heifner heifner @ ociweb.com http://heifner.blogspot.com Object Computing, Inc. (OCI) www.ociweb.com

I have this compile error: I did this: std::for_each(map.begin(), map.end(), bind( &BlockList::sortY, this, *bind(&MyMap::value_type::second, _1))); ../BlockList.cpp:769: error: no matching function for call to âbind(<unknown type>, const BlockList* const, const boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::other_action<boost::lambda::contentsof_action>, boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::action<2, boost::lambda::function_action<2, boost::lambda::detail::unspecified> >, boost::tuples::tuple<BlockDataList* std::pair<const std::pair<int, int>, BlockDataList*>::* const, const boost::lambda::lambda_functor<boost::lambda::placeholder<1>
, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> > , boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> > >)â make: *** [BlockList.o] Error 1
--- Kevin Heifner <heifner_k@ociweb.com> wrote:
yinglcs2@yahoo.com wrote:
I have a for loop which pass the map.second to a function, like this: class A; typedef map<int, A*> MyMap;
sortY(A& a);
for (MyMap::iterator iter = map.begin(); iter != map.end(); ++iter) { A *a = (*iter).second;
sortY(*a); }
how can I translate the above for() loop into for_each and use boost lambda?
I didn't test the following, but it should work :)
#include <boost/lambda/lambda.hpp> #include <boost/lambda/bind.hpp>
using boost::lambda::_1; using boost::lambda::bind;
std::for_each(map.begin(), map.end(), bind(&sortY, *bind(&MyMap::value_type::second, _1)));
KevinH -- Kevin Heifner heifner @ ociweb.com http://heifner.blogspot.com Object Computing, Inc. (OCI) www.ociweb.com _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users
__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com

yinglcs2@yahoo.com wrote:
I have this compile error: I did this:
std::for_each(map.begin(), map.end(), bind( &BlockList::sortY, this, *bind(&MyMap::value_type::second, _1)));
Works for me, boost 1.33 VC7.1: class A{}; typedef std::map<int, A*> MyMap; class BlockList { public: void sortY(A& a) {} void doIt() { using boost::lambda::_1; using boost::lambda::bind; MyMap map; std::for_each(map.begin(), map.end(), bind( &BlockList::sortY, this, *bind(&MyMap::value_type::second, _1))); } }; KevinH -- Kevin Heifner heifner @ ociweb.com http://heifner.blogspot.com Object Computing, Inc. (OCI) www.ociweb.com

Sorry. That works. I made a mistake myself. --- Kevin Heifner <heifner_k@ociweb.com> wrote:
yinglcs2@yahoo.com wrote:
I have a for loop which pass the map.second to a function, like this: class A; typedef map<int, A*> MyMap;
sortY(A& a);
for (MyMap::iterator iter = map.begin(); iter != map.end(); ++iter) { A *a = (*iter).second;
sortY(*a); }
how can I translate the above for() loop into for_each and use boost lambda?
I didn't test the following, but it should work :)
#include <boost/lambda/lambda.hpp> #include <boost/lambda/bind.hpp>
using boost::lambda::_1; using boost::lambda::bind;
std::for_each(map.begin(), map.end(), bind(&sortY, *bind(&MyMap::value_type::second, _1)));
KevinH -- Kevin Heifner heifner @ ociweb.com http://heifner.blogspot.com Object Computing, Inc. (OCI) www.ociweb.com _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users
__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com

On Tuesday 21 February 2006 15:31, yinglcs2@yahoo.com wrote:
I have the following code which copy items if certain condition is met:
copy_if(a.begin(), a.end(), back_inserter(b), bind( &::feq<float>, _1, max)) );
How can I reverse the logic of that?
Consider using remove_copy_if instead of copy_if. Daniel
participants (7)
-
Daniel Mitchell
-
David Abrahams
-
Jeff Flinn
-
Kevin Heifner
-
Nico Galoppo
-
Peter Dimov
-
yinglcs2@yahoo.com