Boost logo

Boost Users :

Subject: [Boost-users] transform_iterator requirement on the Iterator?
From: Hicham Mouline (hicham_at_[hidden])
Date: 2009-09-10 09:53:34


Hi,

 

>From the docs, I don't see the Iterator argument is required to be
default-constructible.

 

I have a gcc4.3.3 error stack that looks like:

 

 

 

/usr/include/boost-1_37/boost/iterator/iterator_adaptor.hpp: In constructor
'boost::iterator_adaptor<Derived, Base, Value, Traversal, Reference,
Difference>::iterator_adaptor() [with Derived =
boost::transform_iterator<Math::Curve1D<MathTest::Curve1D::CurveSVOTrait>::G
etXIter, Math::CurveContainerIter<std::pair<double, double>, 4u, true>,
boost::use_default, boost::use_default>, Base =
Math::CurveContainerIter<std::pair<double, double>, 4u, true>, Value = const
double, Traversal = boost::use_default, Reference = const double&,
Difference = boost::use_default]':

 

/usr/include/boost-1_37/boost/iterator/transform_iterator.hpp:100:
instantiated from 'boost::transform_iterator<UnaryFunction, Iterator,
Reference, Value>::transform_iterator() [with UnaryFunc =
Math::Curve1D<MathTest::Curve1D::CurveSVOTrait>::GetXIter, Iterator =
Math::CurveContainerIter<std::pair<double, double>, 4u, true>, Reference =
boost::use_default, Value = boost::use_default]'

 

/usr/lib/gcc/x86_64-redhat-linux/4.3.3/../../../../include/c++/4.3.3/bits/st
l_algo.h:2086: instantiated from '_FIter std::lower_bound(_FIter, _FIter,
const _Tp&) [with _FIter =
boost::transform_iterator<Math::Curve1D<MathTest::Curve1D::CurveSVOTrait>::G
etXIter, Math::CurveContainerIter<std::pair<double, double>, 4u, true>,
boost::use_default, boost::use_default>, _Tp = double]'

  _____

math/interExtrapolators/interExtrapolate.hpp:75: instantiated from
'typename std::iterator_traits<fIterType>::value_type
Math::InterExtrapolators::InterExtrapolate(xIterType, xIterType, fIterType,
typename std::iterator_traits<_OI>::value_type, typename
boost::call_traits<T>::param_type, typename
boost::call_traits<Extrap>::param_type) [with Interp =
Math::InterExtrapolators::StairCase1D, Extrap =
Math::InterExtrapolators::StairCase1D, xIterType =
boost::transform_iterator<Math::Curve1D<MathTest::Curve1D::CurveSVOTrait>::G
etXIter, Math::CurveContainerIter<std::pair<double, double>, 4u, true>,
boost::use_default, boost::use_default>, fIterType =
boost::transform_iterator<Math::Curve1D<MathTest::Curve1D::CurveSVOTrait>::G
etFIter, Math::CurveContainerIter<std::pair<double, double>, 4u, true>,
boost::use_default, boost::use_default>]'

...

mathTest/curve1D.cpp:72: instantiated from here

/usr/include/boost-1_37/boost/iterator/iterator_adaptor.hpp:279: error: no
matching function for call to 'Math::CurveContainerIter<std::pair<double,
double>, 4u, true>::CurveContainerIter()'

 

 

 

 

 

where it seems the compiler is looking for CurveContainerIter() with no
arguments.

but such constructor does not exist because the iterator has a member
reference to the container.

 

Or is this a requirement of std::lower_bound? Basically, the last line of
the stack that is my code is

 

xIterType xiter = std::lower_bound( xbegin, xend, x );

 

where xIterType is

typedef boost::transform_iterator<GetXIter,ContainerConstIterType>
xIterType;

 

GetXIter is a unary function object, and ContainerConstIterType is
CurveContainerIter<..., true> , true being for const'ness of the iterator.

 

Xbegin, xend and x all of xIterType

 

Regards,



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net