|
Boost Users : |
Subject: [Boost-users] nested lambda::bind expression and ptr_vector
From: Archie14 (admin_at_[hidden])
Date: 2009-09-30 18:32:01
/*
can't get the following code to compile. I need to find an templated instance
in the list where id is equal 15.
*/
#include "stdafx.h"
#include <boost/ptr_container/ptr_vector.hpp>
#include <boost/lambda/bind.hpp>
class A
{
public:
int id() const {return _id;}
private:
int _id;
};
template <typename T> class AA
{
public:
const T& item() {return _item;}
private:
T _item;
};
int _tmain(int argc, _TCHAR* argv[])
{
typedef AA<A> thistype;
boost::ptr_vector<thistype > lst;
int comparewith (15);
std::find (lst.begin(), lst.end(),
(boost::lambda::bind (&A::id,
boost::lambda::bind(&thistype::item,
boost::lambda::_1)) ==
comparewith)
);
return 0;
}
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net