Merge branch 'develop'

This commit is contained in:
Ion Gaztañaga
2014-08-14 12:18:03 +02:00
5 changed files with 55 additions and 22 deletions

View File

@@ -638,7 +638,7 @@ will get the non-const copy constructor overload, which will surely surprise use
}
This limitation forces the user to define a const version of the copy assignment,
in all classes holding copyable and movable classes which might annoying in some cases.
in all classes holding copyable and movable classes which might be annoying in some cases.
An alternative is to implement a single `operator =()` for copyable and movable classes
[@http://cpp-next.com/archive/2009/08/want-speed-pass-by-value/ using "pass by value" semantics]:
@@ -755,6 +755,12 @@ Many thanks to all boosters that have tested, reviewed and improved the library.
[section:release_notes Release Notes]
[section:release_notes_boost_1_57_00 Boost 1.57 Release]
* Fixed bug [@https://svn.boost.org/trac/boost/ticket/9785 Trac #9785: ['"Compiler warning with intel icc in boost/move/core.hpp"]],
[endsect]
[section:release_notes_boost_1_56_00 Boost 1.56 Release]
* Added [macroref BOOST_MOVE_RET BOOST_MOVE_RET].

View File

@@ -45,7 +45,11 @@
#include <boost/move/detail/meta_utils.hpp>
//Move emulation rv breaks standard aliasing rules so add workarounds for some compilers
#if defined(__GNUC__) && (__GNUC__ >= 4)
#if defined(__GNUC__) && (__GNUC__ >= 4) && \
(\
defined(BOOST_GCC) || \
(defined(BOOST_INTEL) && (BOOST_INTEL_CXX_VERSION >= 1300)) \
)
#define BOOST_MOVE_ATTRIBUTE_MAY_ALIAS __attribute__((__may_alias__))
#else
#define BOOST_MOVE_ATTRIBUTE_MAY_ALIAS

View File

@@ -120,6 +120,29 @@ struct is_lvalue_reference<T&>
: public integral_constant<bool, true>
{};
//remove_reference
template<class T>
struct remove_reference
{
typedef T type;
};
template<class T>
struct remove_reference<T&>
{
typedef T type;
};
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
template<class T>
struct remove_reference<T&&>
{
typedef T type;
};
#endif
template<class T>
struct is_class_or_union
{

View File

@@ -17,6 +17,7 @@
#include <boost/move/detail/config_begin.hpp>
#include <boost/move/core.hpp>
#include <boost/move/detail/meta_utils.hpp>
#include <boost/static_assert.hpp>
#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED)
@@ -96,8 +97,6 @@
#else //!BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE
#include <boost/type_traits/remove_reference.hpp>
namespace boost {
//! This trait's internal boolean `value` is false in compilers with rvalue references
@@ -129,14 +128,14 @@
//Old move approach, lvalues could bind to rvalue references
template <class T>
inline typename remove_reference<T>::type && move(T&& t) BOOST_NOEXCEPT
inline typename ::boost::move_detail::remove_reference<T>::type && move(T&& t) BOOST_NOEXCEPT
{ return t; }
#else //BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES
template <class T>
inline typename remove_reference<T>::type && move(T&& t) BOOST_NOEXCEPT
{ return static_cast<typename remove_reference<T>::type &&>(t); }
inline typename ::boost::move_detail::remove_reference<T>::type && move(T&& t) BOOST_NOEXCEPT
{ return static_cast<typename ::boost::move_detail::remove_reference<T>::type &&>(t); }
#endif //BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES
@@ -170,17 +169,18 @@
#else //Old move
//Implementation #5 from N2951, thanks to Howard Hinnant
template <class T, class U>
inline T&& forward(U&& t
, typename ::boost::move_detail::enable_if_c<
move_detail::is_lvalue_reference<T>::value ? move_detail::is_lvalue_reference<U>::value : true>::type * = 0/*
, typename ::boost::move_detail::enable_if_c<
move_detail::is_convertible
<typename remove_reference<U>::type*, typename remove_reference<T>::type*>::value>::type * = 0*/) BOOST_NOEXCEPT
template <class T>
inline T&& forward(typename ::boost::move_detail::remove_reference<T>::type& t) BOOST_NOEXCEPT
{ return static_cast<T&&>(t); }
template <class T>
inline T&& forward(typename ::boost::move_detail::remove_reference<T>::type&& t) BOOST_NOEXCEPT
{
//"boost::forward<T> error: 'T' is a lvalue reference, can't forward as rvalue.";
BOOST_STATIC_ASSERT(!boost::move_detail::is_lvalue_reference<T>::value);
return static_cast<T&&>(t);
}
#endif //BOOST_MOVE_DOXYGEN_INVOKED
} //namespace boost {