Fixes #8420 and some clang errors.

This commit is contained in:
Ion Gaztañaga
2014-02-24 08:29:31 +01:00
parent f1de12bfef
commit 51c9e874a8
4 changed files with 25 additions and 8 deletions

View File

@ -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]

View File

@ -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{

View File

@ -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 <class T, class U>
struct is_convertible
{
static const bool value = __is_convertible_to(T, U);
};
#else
template <class T, class U>
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 <typename Condition1, typename Condition2, typename Condition3 = integral_constant<bool, true> >
struct and_

View File

@ -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;
}