Boost logo

Boost Users :

From: Frank Birbacher (bloodymir.crap_at_[hidden])
Date: 2006-04-27 07:37:33


Hi!

Hmm, I was wrong in my subject. The question is regarding lambda, not
mpl. So here again:

Frank Birbacher wrote:
> Hi!
>
> I want to create a container of pointers to objects in a range
> (first,last(. I tried to use mpl, but have been without success. I
> understand, that the lambda "&_1" cannot specify its concrete return
> type, so I added ret<T>(...). But the resulting lambda is rejected by
> the make_transform_iterator function. I'm using boost 1.33.0 on gcc 4.0.2
>
> //****** CODE BEGIN ******
> #include <vector>
> #include <iterator>
> #include <boost/iterator/transform_iterator.hpp>
> #include <boost/lambda/lambda.hpp>
>
> template<typename Iterator>
> void foo(Iterator first, Iterator last)
> {
> using boost::make_transform_iterator;
> using namespace boost::lambda;
>
> typedef typename std::iterator_traits<Iterator>::pointer Pointer;
> std::vector<Pointer> objectPointers(
> make_transform_iterator(first, ret<Pointer>(&_1)),
> make_transform_iterator(last, ret<Pointer>(&_1))
> );
> // ...
> }
>
> int main()
> {
> std::vector<int> v;
> //instantiate template:
> foo(v.begin(), v.end());
> }
> //***** CODE END ******
>
> // ** ERROR on GCC 4.0.2: **
> /mnt/daten/develop/boost/boost/iterator/transform_iterator.hpp:43:
> Fehler: kein Typ namens »result_type« in »class
> boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::explicit_return_type_action<int*>,
> boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::other_action<boost::lambda::addressof_action>,
> boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::placeholder<1>
>
>>, boost::tuples::null_type, boost::tuples::null_type,
>
> boost::tuples::null_type, boost::tuples::null_type,
> boost::tuples::null_type, boost::tuples::null_type,
> boost::tuples::null_type, boost::tuples::null_type,
> boost::tuples::null_type> > >, boost::tuples::null_type,
> boost::tuples::null_type, boost::tuples::null_type,
> boost::tuples::null_type, boost::tuples::null_type,
> boost::tuples::null_type, boost::tuples::null_type,
> boost::tuples::null_type, boost::tuples::null_type> > >«
>
> The error says it cannot find the type "result_type" in "class ....".
> What is wrong here?
>
> Frank


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