Boost logo

Boost :

From: Neal Becker (ndbecker2_at_[hidden])
Date: 2005-09-01 20:13:02


Previously, I had implemented a nice complex_to_real iterator adapter. It
used the older real(z) and imag(z) that return value, not ref. Now it
seems it gcc-4.0.1, at least, there are .imag() and .real() that return
ref. So I thought I'd update c_to_r adaptor to use them. But, I can't
seem to get this to work. Any hints?

Here's what I get:
g++ -c -I src test2.cc
/usr/include/boost/iterator/iterator_facade.hpp: In static member function
‘static typename Facade::reference
boost::iterator_core_access::dereference(const Facade&) [with Facade =
boost::c_to_r_adapt<__gnu_cxx::__normal_iterator<main()::Complex*,
std::vector<main()::Complex, std::allocator<main()::Complex> > > >]’:
/usr/include/boost/iterator/iterator_facade.hpp:635: instantiated from
‘Reference boost::iterator_facade<I, V, TC, R, D>::operator*() const [with
Derived =
boost::c_to_r_adapt<__gnu_cxx::__normal_iterator<main()::Complex*,
std::vector<main()::Complex, std::allocator<main()::Complex> > > >, Value =
double, CategoryOrTraversal = boost::random_access_traversal_tag, Reference
= double&, Difference = ptrdiff_t]’
/usr/lib/gcc/x86_64-redhat-linux/4.0.1/../../../../include/c++/4.0.1/bits/stl_algobase.h:285:
instantiated from ‘static _OI std::__copy<_BoolType,
std::random_access_iterator_tag>::copy(_II, _II, _OI) [with _II = double*,
_OI = boost::c_to_r_adapt<__gnu_cxx::__normal_iterator<main()::Complex*,
std::vector<main()::Complex, std::allocator<main()::Complex> > > >, bool
_BoolType = false]’
/usr/lib/gcc/x86_64-redhat-linux/4.0.1/../../../../include/c++/4.0.1/bits/stl_algobase.h:317:
instantiated from ‘_OI std::__copy_aux(_II, _II, _OI) [with _II = double*,
_OI = boost::c_to_r_adapt<__gnu_cxx::__normal_iterator<main()::Complex*,
std::vector<main()::Complex, std::allocator<main()::Complex> > > >]’
/usr/lib/gcc/x86_64-redhat-linux/4.0.1/../../../../include/c++/4.0.1/bits/stl_algobase.h:335:
instantiated from ‘static _OI std::__copy_normal<true, false>::copy_n(_II,
_II, _OI) [with _II = __gnu_cxx::__normal_iterator<double*,
std::vector<double, std::allocator<double> > >, _OI =
boost::c_to_r_adapt<__gnu_cxx::__normal_iterator<main()::Complex*,
std::vector<main()::Complex, std::allocator<main()::Complex> > > >]’
/usr/lib/gcc/x86_64-redhat-linux/4.0.1/../../../../include/c++/4.0.1/bits/stl_algobase.h:387:
instantiated from ‘_OutputIterator std::copy(_InputIterator,
_InputIterator, _OutputIterator) [with _InputIterator =
__gnu_cxx::__normal_iterator<double*, std::vector<double,
std::allocator<double> > >, _OutputIterator =
boost::c_to_r_adapt<__gnu_cxx::__normal_iterator<main()::Complex*,
std::vector<main()::Complex, std::allocator<main()::Complex> > > >]’
test2.cc:12: instantiated from here
/usr/include/boost/iterator/iterator_facade.hpp:517: error: invalid
initialization of reference of type ‘double&’ from expression of type
‘const double’




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