Boost logo

Boost :

Subject: Re: [boost] [optional] optional(Expr&&) is insufficiently constrained
From: Andrzej Krzemienski (akrzemi1_at_[hidden])
Date: 2016-02-18 19:19:37


2016-02-18 23:03 GMT+01:00 Stephan T. Lavavej <stl_at_[hidden]>:

> Hi,
>
> A user reported a bug (VSO#191303/Connect#2351203, see [1]) using
> Boost.Optional with MSVC 2015 Update 2. The original test case involved a
> minor bug in VC's tuple, which I'll look into fixing in the future
> (specifically, N-tuples recursively construct (N - 1)-tuples, in a way
> that's visible to overload resolution). However, there is also a bug in
> boost::optional.
>

Hi,
I have created a ticket abut this problem:
https://svn.boost.org/trac/boost/ticket/12002
Frankly, I do not know how to implement it in a portable way (considering
older compilers) without type trait boost::is_constructible. I am currently
blocked on it: https://svn.boost.org/trac/boost/ticket/12003.

As an aside, the "prevent_binding" stuff should probably be expressed as a
> SFINAE constraint, not a static_assert.
>

About this remark, I am not sure. I understand that you want the
constructors to be SFINAE-friendly, but at the same time I would loose the
opportunity to convey a text message to the user-programmers, as to what
the problem is. Now I do it with the static_assert.

I wish I had the feature "delete for a reason"

Optional::Optional(R&&r) = delete("because it would cause...");

Regards,
&rzej


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