Boost logo

Boost :

Subject: Re: [boost] [any] Divergence between Boost.Any and standard library proposal
From: Beman Dawes (bdawes_at_[hidden])
Date: 2013-05-06 08:18:13


On Sat, May 4, 2013 at 3:09 PM, Antony Polukhin <antoshkka_at_[hidden]> wrote:
...
>>> Looks like I broke it in https://svn.boost.org/trac/boost/ticket/6999 .
>>
>> Should I create a new ticket:-)
>
> Fixed in trunk.

Great!

> BTW, draft tells nothing about any_cast<type&&>(instance_of_any).
> Current Boost version will return rvalue if `instance_of_any` is not
> const and fail to compile other way.

Interesting!

To movable_test.cpp, I added:

    std::cout << "move assign from any contents by rvalue reference"
<< std::endl;
    m = any_cast<movable&&>(x1);

Worked for the current Boost trunk with both GCC and VC++, but VC++
2012 produced a warning:

c:\boost\trunk\boost\any.hpp(272): warning C4172: returning address of
local variable or temporary
          c:\dot16\dot16\test\movable_test.cpp(61) : see reference to
function template instantiation 'ValueType
boost::any_cast<movable&&>(boost::any &)' being compiled
          with
          [
              ValueType=movable &&
          ]

--Beman


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