Boost logo

Boost :

Subject: Re: [boost] [RangeEx] Using istream_range?
From: Robert Jones (robertgbjones_at_[hidden])
Date: 2008-10-21 09:21:22


On Tue, Oct 21, 2008 at 1:44 PM, Neil Groves <neil_at_[hidden]>wrote:

> Hi Rob,
>
> I have uploaded what I believe to be a corrected version of istream_range.
> I
> have to confess that I have not yet been able to check this on a GCC
> compiler, but I think I simply had two template parameter types switched.
> My
> test case was using 'char' for both 'Type' and 'Elem' hence I did not
> detect
> the issue.
>
> I am installing Xcode as we speak on a Mac so I will in due course find out
> if this works on GCC. Since the change did not make things any worse I have
> posted it anyhow.
>
>
Hi Neil

Thanks for that - that now works for me!

However, (sorry!), the next step, using adaptors, fails when I only include
the
adaptors header file. Source and error attached.

#include <iostream>
#include <iterator>
#include "boost/range.hpp"
#include "boost/range/istream_range.hpp"
#include "boost/range/algorithm.hpp"
#include "boost/range/adaptors.hpp"

void f( int );

int main( )
{
  boost :: for_each(
      boost :: istream_range< int >( std :: cin ),
      f );
  return 0;
}

$ g++ -I.. -c junk.cpp
In file included from ../boost/range/adaptors.hpp:24,
                 from junk.cpp:6:
../boost/range/adaptor/map.hpp:69: error: `transform_fn_type' was not
declared in this scope
../boost/range/adaptor/map.hpp:69: error: `source_range_type' was not
declared in this scope
../boost/range/adaptor/map.hpp:69: error: template argument 1 is invalid
../boost/range/adaptor/map.hpp:69: error: template argument 2 is invalid
../boost/range/adaptor/map.hpp:69: error: expected nested-name-specifier
../boost/range/adaptor/map.hpp:71: error: expected `)' before "fn"
../boost/range/adaptor/map.hpp:76: error: expected `,' or `...' before '&'
token
../boost/range/adaptor/map.hpp:76: error: ISO C++ forbids declaration of
`base' with no type
../boost/range/adaptor/map.hpp: In constructor
`boost::range_detail::select_first_range<StdPairRng>::select_first_range(
int)':
../boost/range/adaptor/map.hpp:76: error: class
`boost::range_detail::select_first_range<StdPairRng>' does not have any
field named `base'
../boost/range/adaptor/map.hpp:76: error: `other' undeclared (first use this
function)
../boost/range/adaptor/map.hpp:76: error: (Each undeclared identifier is
reported only once for each function it appears
 in.)
../boost/range/adaptor/map.hpp: At global scope:
../boost/range/adaptor/map.hpp:85: error: `transform_fn_type' was not
declared in this scope
../boost/range/adaptor/map.hpp:85: error: `source_range_type' was not
declared in this scope
../boost/range/adaptor/map.hpp:85: error: template argument 1 is invalid
../boost/range/adaptor/map.hpp:85: error: template argument 2 is invalid
../boost/range/adaptor/map.hpp:85: error: expected nested-name-specifier
../boost/range/adaptor/map.hpp:87: error: expected `)' before "fn"
../boost/range/adaptor/map.hpp:92: error: expected `,' or `...' before '&'
token
../boost/range/adaptor/map.hpp:92: error: ISO C++ forbids declaration of
`base' with no type
../boost/range/adaptor/map.hpp: In constructor
`boost::range_detail::select_second_mutable_range<StdPairRng>::select_sec
ond_mutable_range(int)':
../boost/range/adaptor/map.hpp:92: error: class
`boost::range_detail::select_second_mutable_range<StdPairRng>' does not
have any field named `base'
../boost/range/adaptor/map.hpp:92: error: `other' undeclared (first use this
function)
../boost/range/adaptor/map.hpp: At global scope:
../boost/range/adaptor/map.hpp:101: error: `transform_fn_type' was not
declared in this scope
../boost/range/adaptor/map.hpp:101: error: `source_range_type' was not
declared in this scope
../boost/range/adaptor/map.hpp:101: error: template argument 1 is invalid
../boost/range/adaptor/map.hpp:101: error: template argument 2 is invalid
../boost/range/adaptor/map.hpp:101: error: expected nested-name-specifier
../boost/range/adaptor/map.hpp:103: error: expected `)' before "fn"
../boost/range/adaptor/map.hpp:108: error: expected `,' or `...' before '&'
token
../boost/range/adaptor/map.hpp:108: error: ISO C++ forbids declaration of
`base' with no type
../boost/range/adaptor/map.hpp: In constructor
`boost::range_detail::select_second_const_range<StdPairRng>::select_secon
d_const_range(int)':
../boost/range/adaptor/map.hpp:108: error: class
`boost::range_detail::select_second_const_range<StdPairRng>' does not h
ave any field named `base'
../boost/range/adaptor/map.hpp:108: error: `other' undeclared (first use
this function)
In file included from ../boost/range/adaptors.hpp:31,
                 from junk.cpp:6:
../boost/range/adaptor/uniqued.hpp: At global scope:
../boost/range/adaptor/uniqued.hpp:37: error: expected nested-name-specifier
../boost/range/adaptor/uniqued.hpp:37: error:
`adjacent_filter_range<boost::range_detail::unique_not_equal_to,ForwardRng
>' specified as declarator-id
../boost/range/adaptor/uniqued.hpp:37: error: two or more data types in
declaration of `adjacent_filter_range<boost::ran
ge_detail::unique_not_equal_to,ForwardRng>'
../boost/range/adaptor/uniqued.hpp:37: error: expected `;' before "base"
../boost/range/adaptor/uniqued.hpp: In constructor
`boost::range_detail::unique_range<ForwardRng>::unique_range(ForwardR
ng&)':
../boost/range/adaptor/uniqued.hpp:40: error: class
`boost::range_detail::unique_range<ForwardRng>' does not have any fi
eld named `base'

Regards, Rob.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk