Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2001-10-04 15:03:31


Sorry, Levente, I can't make head or tail of your mail.

If you don't have a real lvalue lying around which you can reference, you
can't use projection_iterator_adaptor.

Is this the problem?

AdaptableUnaryFunction: The type of the function object. The argument_type
of the function must match the value type of the base iterator. The function
should return a reference to the function's result_type. The result_type
will be the resulting iterator's value_type.

Is the result_type of an AdaptableUnaryFunction returning a reference
supposed to be a reference type? I would think so. Our documentation seems
to suggest making the result_type a value instead. Jeremy?

===================================================
  David Abrahams, C++ library designer for hire
 resume: http://users.rcn.com/abrahams/resume.html

        C++ Booster (http://www.boost.org)
          email: david.abrahams_at_[hidden]
===================================================

----- Original Message -----
From: "Levente Farkas" <lfarkas_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Thursday, October 04, 2001 2:44 PM
Subject: Re: [boost] more problem with functional + projection_iterator

> yes. ok it's a stupid example, but I don't want to make it more
compilcated.
> suppose I have a function which smooth an iterator range than change the
> copy to smooth, that my iterator has to return a reference not a value:
> --------------------------
> smooth(
> boost::make_const_projection_iterator(a.begin(),
> boost::compose1(VectorAccess<std::vector<double> >(0),
> MemberAccess<A, std::vector<double> >(&A::y))),
> boost::make_const_projection_iterator(a.end(),
> boost::compose1(VectorAccess<std::vector<double> >(0),
> MemberAccess<A, std::vector<double> >(&A::y))),
> boost::make_const_projection_iterator(a.begin(),
> boost::compose1(VectorAccess<std::vector<double> >(0),
> MemberAccess<A, std::vector<double> >(&A::y))));
> --------------------------
>
>
> David Abrahams wrote:
> >
> > Are you sure you don't want a transform_iterator_adaptor instead?
> >
> > -Dave
> >
> > ===================================================
> > David Abrahams, C++ library designer for hire
> > resume: http://users.rcn.com/abrahams/resume.html
> >
> > C++ Booster (http://www.boost.org)
> > email: david.abrahams_at_[hidden]
> > ===================================================
> >
> > ----- Original Message -----
> > From: "Levente Farkas" <lfarkas_at_[hidden]>
> > To: "boost" <boost_at_[hidden]>
> > Sent: Thursday, October 04, 2001 12:25 PM
> > Subject: [boost] more problem with functional + projection_iterator
> >
> > > hi,
> > > I try to compile the attached example and faild both with MSVC 6sp5
and
> > > gcc-2.96 on linux. the problem is in unary_compose (from compose1).
even
> > if I
> > > switch from std::compose1 to boost::compose1 the problem exists. the
> > reason
> > > is a bit complicated. every function object (subclass of
> > std::unary_function)
> > > return with result_type which is usualy not a reference! what's more
it
> > > can't be a reference since everybody suppose these functions are
return
> > > with T& and result_type defined as T. that's the reason why
> > projection_iterator
> > > suppose it and put & the place where it's required. IMHO this whole
> > > thing is a huge design mistake. result_type should have to be defined
> > > as the real result type of operator(). anyway this would be a better
> > > choise for argument_type too. solutions (if we don't would like to
> > > change the whole stl paradigm to right way result_type have to be the
> > > real result type,...) to change all functionals definition to
> > > typename call_traits<typename
> > unary_traits<Operation1>::result_type>::param_type
> > > in this case all functor can be used as an argumnet for another
functor.
> > > without this this's unsolvable.
> > > or anybody has any better idea?
> > >
> > > -- Levente "Si vis pacem para bellum!"
> > > Info: http://www.boost.org Unsubscribe:
> > <mailto:boost-unsubscribe_at_[hidden]>
> > >
> > > Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
> > >
> > >
> >
> > Info: http://www.boost.org Unsubscribe:
<mailto:boost-unsubscribe_at_[hidden]>
> >
> > Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
>
>
> --
> -- Levente "Si vis pacem para bellum!"
>
> Info: http://www.boost.org Unsubscribe:
<mailto:boost-unsubscribe_at_[hidden]>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>


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