$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [boost] [iterator] transform_iterator and move-only types
From: Nathan Ridge (zeratul976_at_[hidden])
Date: 2012-08-25 16:06:51
> > The following code fails to compile for me:
> >
> >
> > #include <memory>
> > #include <boost/iterator/transform_iterator.hpp>
> >
> > std::unique_ptr<int> foo(int i)
> > {
> > return std::unique_ptr<int>(new int(i));
> > }
> >
> > int main()
> > {
> > int a[5] = {1, 2, 3, 4, 5};
> > auto it = boost::make_transform_iterator(a, foo);
> > }
> >
> >
> > The error message I get with GCC 4.8 is pasted below.
> >
> > I think this should work because returning a move-only type
> > from a function by value is a perfectly valid thing to do.
> > Do you agree? Should I file a bug?
>
> Seems reasonable, but upon an initial inspection, this looks like a hiccup
> in boost::is_convertible...I'm not saying that once that gets sorted out,
> there won't be something wrong in boost::transform_iterator, but
> is_convertible should probably be addressed first.
>
> In any case, this looks like this same problem that John Bytheway
> identified in the thread titled "[boost] [type_traits][parameter]
> Inconsistent boost::is_convertible between gcc and clang".
Ah, I see, this works with the latest trunk (which includes the patch
posted in that thread). Thanks for the heads up!
Regards,
Nate