Boost logo

Boost :

Subject: Re: [boost] [iterator] function_output_iterator constructed from a lambda function is not assignable
From: Paul Fultz II (pfultz2_at_[hidden])
Date: 2016-02-15 15:01:17


On Sunday, February 14, 2016 at 9:18:15 PM UTC-6, Peter Dimov wrote:
>
> Paul Fultz II wrote:
>
> > One way to deal with this is to put it into boost::optional.
>
> boost::optional<T> uses T::operator= when the source and the target hold a
> value.
>

It seems that boost::optional is not constrained properly, the following
compiles just fine:

struct not_assignable
{
    not_assignable& operator=(const not_assignable&)=delete;
};
static_assert(!std::is_copy_assignable<not_assignable>(), "Assignable");
static_assert(std::is_copy_assignable<boost::optional<not_assignable>>(),
"Not Assignable");

However, if I use the assignment operator, it breaks with a compile error.
Either way `boost::optional` should fallback on in-place new, when there is
no
assignment operator.

> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>


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