$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [boost] [RangeEx] Using istream_range?
From: Robert Jones (robertgbjones_at_[hidden])
Date: 2008-10-22 08:59:43
Hi Neil
Another one for you....
This may not be entirely due to your lib, but it is a fairly obvious
use-case.
This code works fine....
#include <iostream>
#include <iterator>
#include <list>
#include "boost/range.hpp"
#include "boost/range/istream_range.hpp"
#include "boost/range/algorithm.hpp"
#include "boost/range/adaptors.hpp"
#include "boost/lambda/lambda.hpp"
using namespace boost;
using namespace boost :: lambda;
int times_two( int i ) { return ( _1 * 2 )( i ); }
int main( )
{
int vals[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
copy(
vals | adaptors :: transformed( times_two ),
std :: ostream_iterator< int >( std :: cout, "\n" ) );
return 0;
}
But this code doesn't....
#include <iostream>
#include <iterator>
#include <list>
#include "boost/range.hpp"
#include "boost/range/istream_range.hpp"
#include "boost/range/algorithm.hpp"
#include "boost/range/adaptors.hpp"
#include "boost/lambda/lambda.hpp"
using namespace boost;
using namespace boost :: lambda;
int times_two( int i ) { return ( _1 * 2 )( i ); }
int main( )
{
int vals[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
copy(
vals | adaptors :: transformed( _1 * 2 ),
std :: ostream_iterator< int >( std :: cout, "\n" ) );
return 0;
}
I have sent you the full error privately as Boost bounced the file due to it
being too large!
Cheers, Rob.