|
Boost Users : |
From: David Abrahams (dave_at_[hidden])
Date: 2006-04-27 13:27:01
Frank Birbacher <bloodymir.crap_at_[hidden]> writes:
> 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
I'm pretty certain this isn't an mpl problem. It looks like it's all
about Boost.Lambda...
> //****** 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> > >«
-- Dave Abrahams Boost Consulting www.boost-consulting.com
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