1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 8 int main() 9 { 10 11 namespace bl = boost::lambda; 12 typedef std::map types; 13 types keys_and_values; 14 keys_and_values 0 = "zero"; 15 keys_and_values 1 = "one"; 16 keys_and_values 2 = "Two"; 17 18 std::for_each( 19 keys_and_values.begin(), 20 keys_and_values.end(), 21 std::cout.
Ahhh thanks. Found out that boot/bind. Hpp was getting included in my project.
Once I removed the include, it worked fine. Don't know why it did not give me a more descriptive error. – navigator May 8 '10 at 17:08 @navigator yes, I ran into that myself.
Boost bind puts _1 in anonymous namespace which causes all kind of confusion with lambda – Anycorn May 8 '10 at 17:10.
Include ... #define foreach BOOST_FOREACH ... foreach(types::value_type kv, keys_and_values) std::cout.
A vastly superior approach to trying to trick std::for_each to do anything beyond trivial! Range-based for loops are also there in C++0x. – UncleBens May 8 '10 at 18:00 I am using for_each in this example just to learn about boost::lambda bind capabilities.
– navigator May 8 '10 at 18:36 @navigator: Ok then. I still think boost. Lambda will also be made obsolete by C++0x.
– UncleBens May 8 '10 at 19:42 1 @UncleBens I think I read that phoenix3 will replace boost.lambda. It still has its place since c++0x lambdas are only monomorphic. Phoenix3 and boost.
Lambda are fully polymorphic. SO you can pass _1.
I am trying to get the below code snippet to compile. Error C2665: 'boost::lambda::function_adaptor::apply' : none of the 8 overloads could convert all the argument types. Sepcifying the return type when calling bind does not help.
Any idea what I am doing wrong?
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.