[boost-users][lambda] crash in std::for_each

The following code crashes in for_each when trying to output the 1st pair.
What's wrong with it?
Thanks!
namespace bl = boost::lambda;
std::map

On Tue, Feb 3, 2009 at 9:45 AM, Igor R
What's the problem? This works for me - full source follows.
#include "boost/lambda/lambda.hpp"
#include "boost/lambda/bind.hpp"
#include <algorithm>
#include <map>
#include <iostream>
#include <sstream>
int main( )
{
namespace bl = boost::lambda;
std::map

Oh no it doesn't ! Please ignore my last post.
On Tue, Feb 3, 2009 at 12:29 PM, Robert Jones
-- ACCU - Professionalism in programming - http://www.accu.org

AMDG Stuart Dootson wrote:
The reason is that std::pairs can be converted to each other. If the type doesn't match exactly: 1) It will be implicitly converted to the correct type. 2) Then you get a reference to first. 3) Then the temporary created in step 1 is destroyed 4) Then you stream first (which has just been destroyed) In Christ, Steven Watanabe

On Tue, Feb 3, 2009 at 9:45 AM, Igor R
#include "boost/lambda/lambda.hpp"
#include "boost/lambda/bind.hpp"
#include <algorithm>
#include <map>
#include <iostream>
#include <sstream>
int main( )
{
namespace bl = boost::lambda;
typedef std::map
participants (4)
-
Igor R
-
Robert Jones
-
Steven Watanabe
-
Stuart Dootson