Closed Fraser999 closed 9 years ago
Hi,
I don't want to replace the static_addressof. We could have a flag that makes it use std::addressof if the user prefers it. Do you mind to prepare this patch?
Could you provide two PR? one for the test and one for the patch?
Thanks, Vicente
Sure thing.
I guess we could call the flag BOOST_EXPECTED_USE_STD_ADDRESSOF
and define it similarly to BOOST_EXPECTED_NO_CXX11_MOVE_ACCESSORS
so it's defaulted for MSVC <= 2013?
Sorry - I just reread my comment and I didn't mean completely as per BOOST_EXPECTED_NO_CXX11_MOVE_ACCESSORS
, I just meant to define it for _MSC_VER < 1900. Do you know if there's a minimum version of Clang or GCC for which it should be defined too? I only have up-to-date versions of these handy.
OK - I've created https://github.com/ptal/expected/pull/75 and https://github.com/ptal/expected/pull/76, so I'll close this one.
I've left in the const overloads of errorptr()
since I guess they're not doing any harm.
Yeah - I didn't see your comment before I closed this. I've already fixed that in my new PR - obviously I took the more tedious path and defined a default c'tor rather than removing the const :-)
The test passes on OS X (Clang 3.5) and MSVC 2013 after both PRs are merged.
For your information, the need of this static_address_of is because std::address_of is not constexpr.
The test I added exposes a bug in expected.hpp where the calls to
static_addressof
need to be prefixed withdetail::
.However if that's applied, with MSVC 2013, the calls to
has_overloaded_addressof::value
generate the following error:due to the lack of
constexpr
support.I couldn't see a reason to not use
std::addressof
in place ofdetail::static_addressof
, but I might well be missing something. If so, feel free to reject the patch and I can just file an issue separately if you want.Finally, I deleted the const overloads of
errorptr()
since they're unused.errorptr()
seems to be useful only in the context of non-const functions like the move c'tor orswap
.