Boost logo

Boost Users :

Subject: [Boost-users] filesystem lambda and for_each
From: Jean-Christophe Roux (jcxxr_at_[hidden])
Date: 2010-08-19 14:43:57


hello, Despite some research, I am struggling to combine boost filesystem, boost lambda and STL for_each. 32 std::string str = ""; 33 std::string path = "/tmp"; 34 boost::filesystem::directory_iterator it(path); 35 while(it != boost::filesystem::directory_iterator()) 36 { 37 str += it->path().filename() + "<br>"; 38 ++it; 39 } works fine but 40 std::for_each(boost::filesystem::directory_iterator(path), boost::filesystem::directory_iterator(), 41 str += *boost::lambda::_1.path().parent_path() ); does not compile with the error message that : error: ‘const struct boost::lambda::lambda_functor<boost::lambda::placeholder<1> >’ has no member named ‘path’ I don't understand why and I don't really see how I could have this work. Also, I am wondering why with _1 instead of boost::lambda::_1 I am getting: error: reference to ‘_1’ is ambiguous /usr/local/include/boost/lambda/core.hpp:69: thanks!



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