Questions regarding lambda expressions

Hello,
I am confused about why two certain lamba expressions work (on VC8)
while two others do not. I do not profess to be any sort of expert in
boost lambda expressions. This code is being executed in a function
which is a friend of a template "takostack". Basically, this function
deals with a member "contents_" that is a scoped_array of scoped_ptrs.
It is supposed to iteratively call the << operator for the elements of
contents_ scoped_array.
template<typename O>
std::ostream& operator<< (std::ostream& os, const
takostack

Matyas W Egyhazy wrote:
Basically, I would like to understand why compilation succeeds without using bind, and fails when bind or the member pointer operator is used.
It would be nice if you could post a complete example so one could compile it as it is. I'm wondering why you call _1 on the functor in all, especially the last example. What's the derefenrencing for? Are you sure the first one works as you intend? Or does it merely compile? Jens

Jens, I have attached a full example now. I have included my questions and error snips from the compiler output within the source.
I'm wondering why you call _1 on the functor in all, especially the last example. Probably because I do not know what I am doing. I still get an error whether I do that or not. See attached example.
What's the derefenrencing for? Are you sure the first one works as you intend? Or does it merely compile? scoped_ptr<T>::get returns a T* so I dereference it before operator<< is called. The behavior works as intended, the operator<< for T is called.
Thanks,
Matt
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include
participants (2)
-
Jens Theisen
-
Matyas W Egyhazy