Bug in boost::lambda using operator <<?
The program below outputs
String: <First string> Second string> Fourth string> Fifth string>
All but the first "<" is missing. Any ideas?
(On vc++7.1 using Boost 1.32.0.)
Richard
All opinions are mine and do not represent in any way the position of
Dell Corporation.
#include <ostream>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include
Richard_Cox@Dell.com wrote:
The program below outputs
String: <First string> Second string> Fourth string> Fifth string>
All but the first "<" is missing. Any ideas? std::for_each(coll.begin(), coll.end(), out << gt << _1 << L"> ");
does this work? std::for_each(coll.begin(), coll.end(), out << var(gt) << _1 << L"> "); not sure of the fix, but out << gt associates left to right and is evaluated once and has the type of out, you want it lazy evaluated so that the whole of the expression is considered as one... see the delaying constants and variables section of the lambda documents. Kevin -- | Kevin Wheatley, Cinesite (Europe) Ltd | Nobody thinks this | | Senior Technology | My employer for certain | | And Network Systems Architect | Not even myself |
participants (2)
-
Kevin Wheatley
-
Richard_Cox@Dell.com