diff --git a/doc/move.qbk b/doc/move.qbk index 05f4baf..b0ff171 100644 --- a/doc/move.qbk +++ b/doc/move.qbk @@ -758,8 +758,9 @@ Many thanks to all boosters that have tested, reviewed and improved the library. [section:release_notes_boost_1_56_00 Boost 1.56 Release] * Added [macroref BOOST_MOVE_RET BOOST_MOVE_RET]. -* Fixed bug [@https://svn.boost.org/trac/boost/ticket/9482 #9482: ['"MSVC macros not undefined in boost/move/detail/config_end.hpp"]]. - [@https://svn.boost.org/trac/boost/ticket/9045 #9045: ['"Wrong macro name on docs"]]. +* Fixed bug [@https://svn.boost.org/trac/boost/ticket/9482 #9482: ['"MSVC macros not undefined in boost/move/detail/config_end.hpp"]], + [@https://svn.boost.org/trac/boost/ticket/9045 #9045: ['"Wrong macro name on docs"]], + [@https://svn.boost.org/trac/boost/ticket/8420 #8420: ['"move's is_convertible does not compile with aligned data"]]. [endsect] diff --git a/example/movable.hpp b/example/movable.hpp index 07912dd..7b1d990 100644 --- a/example/movable.hpp +++ b/example/movable.hpp @@ -35,7 +35,10 @@ class movable { value_ = m.value_; m.value_ = 0; return *this; } bool moved() const //Observer - { return value_ == 0; } + { return !value_; } + + int value() const //Observer + { return value_; } }; namespace boost{ diff --git a/include/boost/move/detail/meta_utils.hpp b/include/boost/move/detail/meta_utils.hpp index 2bdb654..0da3c68 100644 --- a/include/boost/move/detail/meta_utils.hpp +++ b/include/boost/move/detail/meta_utils.hpp @@ -72,19 +72,32 @@ struct identity typedef T type; }; -//is_convertible +#if defined(_MSC_VER) && (_MSC_VER >= 1400) + +//use intrinsic since in MSVC +//overaligned types can't go through ellipsis +template +struct is_convertible +{ + static const bool value = __is_convertible_to(T, U); +}; + +#else + template class is_convertible { typedef char true_t; class false_t { char dummy[2]; }; - static true_t dispatch(U); static false_t dispatch(...); + static true_t dispatch(U); static T &trigger(); public: - enum { value = sizeof(dispatch(trigger())) == sizeof(true_t) }; + static const bool value = sizeof(dispatch(trigger())) == sizeof(true_t); }; +#endif + //and_ not_ template > struct and_ diff --git a/test/move_algorithm.cpp b/test/move_algorithm.cpp index d3944b1..2178328 100644 --- a/test/move_algorithm.cpp +++ b/test/move_algorithm.cpp @@ -40,7 +40,7 @@ int main() boost::move_backward(v2.begin(), v2.end(), v.end()); //Test values have been moved - if(!v2[0].moved()){ + if(!v2[1].moved()){ return 1; } @@ -48,7 +48,7 @@ int main() return 1; } - if(v[0].moved()){ + if(v[1].moved()){ return 1; }