[Boost-users] BOOST_RESULT_OF_USE_DECLTYPE and Boost.Optional ?

14 views
Skip to first unread message

John M. Dlugosz

unread,
May 27, 2012, 8:43:19 AM5/27/12
to boost...@lists.boost.org
Hmm, the error isn't quite what I said:

1>V:\Trunk\stable\src\Include\Tools/async.h(268): error C2664:
'boost::unique_future<R>::unique_future(boost::unique_future<R> &)' : cannot convert
parameter 1 from 'boost::unique_future<R>' to 'boost::unique_future<R> &'
1> with
1> [
1> R=boost::optional<in_addr> &
1> ]
1> and
1> [
1> R=boost::optional<in_addr>
1> ]
1> and
1> [
1> R=boost::optional<in_addr> &
1> ]

But my other test cases of using unique_future (with simple types) work OK.

—John

_______________________________________________
Boost-users mailing list
Boost...@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users

John M. Dlugosz

unread,
May 27, 2012, 2:32:42 PM5/27/12
to boost...@lists.boost.org
I turned on BOOST_RESULT_OF_USE_DECLTYPE and used boost::result_of because the
std::tr1::result_of that comes with VS10 doesn't use declspec at all and thus doesn't work
right with lambda functions.

This passes my unit tests, but fails on a piece of code that has a function returning an
instantiation of boost::optional.

It seems confused as to whether the value held in the optional is as-specified or has a
reference added to it.

I wonder if this is a specific issue with optional that might be
addressed/worked-around/patched, or perhaps there is a way to enable declspec-based
testing just for the code that wanted it and not globally?

Eric Niebler

unread,
May 27, 2012, 5:27:27 PM5/27/12
to boost...@lists.boost.org
On 5/27/2012 11:32 AM, John M. Dlugosz wrote:
> I turned on BOOST_RESULT_OF_USE_DECLTYPE and used boost::result_of
> because the std::tr1::result_of that comes with VS10 doesn't use
> declspec at all and thus doesn't work right with lambda functions.
>
> This passes my unit tests, but fails on a piece of code that has a
> function returning an instantiation of boost::optional.
>
> It seems confused as to whether the value held in the optional is
> as-specified or has a reference added to it.
>
> I wonder if this is a specific issue with optional that might be
> addressed/worked-around/patched, or perhaps there is a way to enable
> declspec-based testing just for the code that wanted it and not globally?

Your best bet is to file a bug against boost.optional. Be sure to
include a small, complete example that demonstrates the problem.

Disclaimer: I am not the maintainer of boost.optional.

--
Eric Niebler
BoostPro Computing
http://www.boostpro.com
Reply all
Reply to author
Forward
0 new messages