diff --git a/doc/Jamfile.v2 b/doc/Jamfile.v2 index 29d3661..df22099 100644 --- a/doc/Jamfile.v2 +++ b/doc/Jamfile.v2 @@ -30,6 +30,7 @@ doxygen autodoc \"BOOST_MOVE_DOC0PTR(T)=std::nullptr_t\" \\ \"BOOST_MOVE_DOC1ST(T1, T2)=T1\" \\ \"BOOST_MOVE_DOCIGN(T1) \"\\ + \"BOOST_MOVE_FORCEINLINE=inline\" \\ " ; diff --git a/include/boost/move/adl_move_swap.hpp b/include/boost/move/adl_move_swap.hpp index 2a010cd..b89ad63 100644 --- a/include/boost/move/adl_move_swap.hpp +++ b/include/boost/move/adl_move_swap.hpp @@ -22,9 +22,8 @@ //Based on Boost.Core's swap. //Many thanks to Steven Watanabe, Joseph Gauterin and Niels Dekker. - -#include #include //for std::size_t +#include //forceinline //Try to avoid including , as it's quite big #if defined(_MSC_VER) && defined(BOOST_DINKUMWARE_STDLIB) @@ -156,7 +155,7 @@ struct and_op_not {}; template -void swap_proxy(T& x, T& y, typename boost::move_detail::enable_if_c::value>::type* = 0) +BOOST_MOVE_FORCEINLINE void swap_proxy(T& x, T& y, typename boost::move_detail::enable_if_c::value>::type* = 0) { //use std::swap if argument dependent lookup fails //Use using directive ("using namespace xxx;") instead as some older compilers @@ -166,14 +165,14 @@ void swap_proxy(T& x, T& y, typename boost::move_detail::enable_if_c -void swap_proxy(T& x, T& y +BOOST_MOVE_FORCEINLINE void swap_proxy(T& x, T& y , typename boost::move_detail::enable_if< and_op_not_impl , boost_move_member_swap::has_member_swap > >::type* = 0) { T t(::boost::move(x)); x = ::boost::move(y); y = ::boost::move(t); } template -void swap_proxy(T& x, T& y +BOOST_MOVE_FORCEINLINE void swap_proxy(T& x, T& y , typename boost::move_detail::enable_if< and_op_impl< boost::move_detail::has_move_emulation_enabled_impl , boost_move_member_swap::has_member_swap > >::type* = 0) @@ -186,7 +185,7 @@ void swap_proxy(T& x, T& y namespace boost_move_adl_swap{ template -void swap_proxy(T& x, T& y) +BOOST_MOVE_FORCEINLINE void swap_proxy(T& x, T& y) { using std::swap; swap(x, y); @@ -223,7 +222,7 @@ namespace boost{ //! - Otherwise a move-based swap is called, equivalent to: //! T t(::boost::move(x)); x = ::boost::move(y); y = ::boost::move(t);. template -void adl_move_swap(T& x, T& y) +BOOST_MOVE_FORCEINLINE void adl_move_swap(T& x, T& y) { ::boost_move_adl_swap::swap_proxy(x, y); } diff --git a/include/boost/move/core.hpp b/include/boost/move/core.hpp index 54aece0..f1e8f58 100644 --- a/include/boost/move/core.hpp +++ b/include/boost/move/core.hpp @@ -197,7 +197,7 @@ namespace move_detail { template - inline typename ::boost::move_detail::enable_if_c + BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_c < ::boost::move_detail::is_lvalue_reference::value || !::boost::has_move_emulation_enabled::value , T&>::type @@ -207,7 +207,7 @@ } template - inline typename ::boost::move_detail::enable_if_c + BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_c < !::boost::move_detail::is_lvalue_reference::value && ::boost::has_move_emulation_enabled::value , ::boost::rv&>::type @@ -217,7 +217,7 @@ } template - inline typename ::boost::move_detail::enable_if_c + BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_c < !::boost::move_detail::is_lvalue_reference::value && ::boost::has_move_emulation_enabled::value , ::boost::rv&>::type @@ -245,9 +245,9 @@ #define BOOST_MOVABLE_BUT_NOT_COPYABLE(TYPE)\ BOOST_MOVE_IMPL_NO_COPY_CTOR_OR_ASSIGN(TYPE)\ public:\ - operator ::boost::rv&() \ + BOOST_MOVE_FORCEINLINE operator ::boost::rv&() \ { return *BOOST_MOVE_TO_RV_CAST(::boost::rv*, this); }\ - operator const ::boost::rv&() const \ + BOOST_MOVE_FORCEINLINE operator const ::boost::rv&() const \ { return *BOOST_MOVE_TO_RV_CAST(const ::boost::rv*, this); }\ private:\ // @@ -263,18 +263,18 @@ TYPE& operator=(TYPE &t)\ { this->operator=(const_cast(t)); return *this;}\ public:\ - operator ::boost::rv&() \ + BOOST_MOVE_FORCEINLINE operator ::boost::rv&() \ { return *BOOST_MOVE_TO_RV_CAST(::boost::rv*, this); }\ - operator const ::boost::rv&() const \ + BOOST_MOVE_FORCEINLINE operator const ::boost::rv&() const \ { return *BOOST_MOVE_TO_RV_CAST(const ::boost::rv*, this); }\ private:\ // #define BOOST_COPYABLE_AND_MOVABLE_ALT(TYPE)\ public:\ - operator ::boost::rv&() \ + BOOST_MOVE_FORCEINLINE operator ::boost::rv&() \ { return *BOOST_MOVE_TO_RV_CAST(::boost::rv*, this); }\ - operator const ::boost::rv&() const \ + BOOST_MOVE_FORCEINLINE operator const ::boost::rv&() const \ { return *BOOST_MOVE_TO_RV_CAST(const ::boost::rv*, this); }\ private:\ // @@ -450,7 +450,7 @@ namespace move_detail { template - inline typename ::boost::move_detail::enable_if_c + BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_c < ::boost::move_detail::is_lvalue_reference::value , T&>::type move_return(T& x) BOOST_NOEXCEPT @@ -459,7 +459,7 @@ } template - inline typename ::boost::move_detail::enable_if_c + BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_c < !::boost::move_detail::is_lvalue_reference::value , Ret && >::type move_return(T&& t) BOOST_NOEXCEPT diff --git a/include/boost/move/detail/config_begin.hpp b/include/boost/move/detail/config_begin.hpp index 342390b..d5b21db 100644 --- a/include/boost/move/detail/config_begin.hpp +++ b/include/boost/move/detail/config_begin.hpp @@ -16,4 +16,5 @@ # pragma warning (disable : 4324) // structure was padded due to __declspec(align()) # pragma warning (disable : 4675) // "function": resolved overload was found by argument-dependent lookup # pragma warning (disable : 4996) // "function": was declared deprecated (_CRT_SECURE_NO_DEPRECATE/_SCL_SECURE_NO_WARNINGS) +# pragma warning (disable : 4714) // "function": marked as __forceinline not inlined #endif diff --git a/include/boost/move/detail/meta_utils.hpp b/include/boost/move/detail/meta_utils.hpp index 323c13a..736c82a 100644 --- a/include/boost/move/detail/meta_utils.hpp +++ b/include/boost/move/detail/meta_utils.hpp @@ -14,13 +14,11 @@ #ifndef BOOST_MOVE_DETAIL_META_UTILS_HPP #define BOOST_MOVE_DETAIL_META_UTILS_HPP -#ifndef BOOST_CONFIG_HPP -# include -#endif -# #if defined(BOOST_HAS_PRAGMA_ONCE) # pragma once #endif +#include +#include //forceinline #include #include //for std::size_t @@ -245,8 +243,8 @@ template struct addr_impl_ref { T & v_; - inline addr_impl_ref( T & v ): v_( v ) {} - inline operator T& () const { return v_; } + BOOST_MOVE_FORCEINLINE addr_impl_ref( T & v ): v_( v ) {} + BOOST_MOVE_FORCEINLINE operator T& () const { return v_; } private: addr_impl_ref & operator=(const addr_impl_ref &); @@ -255,18 +253,18 @@ struct addr_impl_ref template struct addressof_impl { - static inline T * f( T & v, long ) + BOOST_MOVE_FORCEINLINE static T * f( T & v, long ) { return reinterpret_cast( &const_cast(reinterpret_cast(v))); } - static inline T * f( T * v, int ) + BOOST_MOVE_FORCEINLINE static T * f( T * v, int ) { return v; } }; template -inline T * addressof( T & v ) +BOOST_MOVE_FORCEINLINE T * addressof( T & v ) { return ::boost::move_detail::addressof_impl::f ( ::boost::move_detail::addr_impl_ref( v ), 0 ); @@ -561,4 +559,6 @@ template< class T > struct remove_rvalue_reference { typedef T type; }; } //namespace move_detail { } //namespace boost { +#include + #endif //#ifndef BOOST_MOVE_DETAIL_META_UTILS_HPP diff --git a/include/boost/move/detail/workaround.hpp b/include/boost/move/detail/workaround.hpp index b3f81b1..befe141 100644 --- a/include/boost/move/detail/workaround.hpp +++ b/include/boost/move/detail/workaround.hpp @@ -52,4 +52,17 @@ #define BOOST_MOVE_MSVC_AUTO_MOVE_RETURN_BUG #endif +#define BOOST_MOVE_DISABLE_FORCEINLINE + +#if defined(BOOST_MOVE_DISABLE_FORCEINLINE) + #define BOOST_MOVE_FORCEINLINE inline +#elif defined(BOOST_MOVE_FORCEINLINE_IS_BOOST_FORCELINE) + #define BOOST_MOVE_FORCEINLINE BOOST_FORCEINLINE +#elif defined(BOOST_MSVC) && defined(_DEBUG) + //"__forceinline" and MSVC seems to have some bugs in debug mode + #define BOOST_MOVE_FORCEINLINE inline +#else + #define BOOST_MOVE_FORCEINLINE BOOST_FORCEINLINE +#endif + #endif //#ifndef BOOST_MOVE_DETAIL_WORKAROUND_HPP diff --git a/include/boost/move/iterator.hpp b/include/boost/move/iterator.hpp index 1b39e26..f36df23 100644 --- a/include/boost/move/iterator.hpp +++ b/include/boost/move/iterator.hpp @@ -23,6 +23,7 @@ #endif #include +#include //forceinline #include #include @@ -57,22 +58,20 @@ class move_iterator typedef typename boost::movelib::iterator_traits::difference_type difference_type; typedef typename boost::movelib::iterator_traits::iterator_category iterator_category; - move_iterator() + BOOST_MOVE_FORCEINLINE move_iterator() + : m_it() {} - explicit move_iterator(It i) + BOOST_MOVE_FORCEINLINE explicit move_iterator(const It &i) : m_it(i) {} template - move_iterator(const move_iterator& u) - : m_it(u.base()) + BOOST_MOVE_FORCEINLINE move_iterator(const move_iterator& u) + : m_it(u.m_it) {} - iterator_type base() const - { return m_it; } - - reference operator*() const + BOOST_MOVE_FORCEINLINE reference operator*() const { #if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || defined(BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES) return *m_it; @@ -81,34 +80,34 @@ class move_iterator #endif } - pointer operator->() const + BOOST_MOVE_FORCEINLINE pointer operator->() const { return m_it; } - move_iterator& operator++() + BOOST_MOVE_FORCEINLINE move_iterator& operator++() { ++m_it; return *this; } - move_iterator operator++(int) + BOOST_MOVE_FORCEINLINE move_iterator operator++(int) { move_iterator tmp(*this); ++(*this); return tmp; } - move_iterator& operator--() + BOOST_MOVE_FORCEINLINE move_iterator& operator--() { --m_it; return *this; } - move_iterator operator--(int) + BOOST_MOVE_FORCEINLINE move_iterator operator--(int) { move_iterator tmp(*this); --(*this); return tmp; } move_iterator operator+ (difference_type n) const { return move_iterator(m_it + n); } - move_iterator& operator+=(difference_type n) + BOOST_MOVE_FORCEINLINE move_iterator& operator+=(difference_type n) { m_it += n; return *this; } - move_iterator operator- (difference_type n) const + BOOST_MOVE_FORCEINLINE move_iterator operator- (difference_type n) const { return move_iterator(m_it - n); } - move_iterator& operator-=(difference_type n) + BOOST_MOVE_FORCEINLINE move_iterator& operator-=(difference_type n) { m_it -= n; return *this; } - reference operator[](difference_type n) const + BOOST_MOVE_FORCEINLINE reference operator[](difference_type n) const { #if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || defined(BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES) return m_it[n]; @@ -117,29 +116,29 @@ class move_iterator #endif } - friend bool operator==(const move_iterator& x, const move_iterator& y) - { return x.base() == y.base(); } + BOOST_MOVE_FORCEINLINE friend bool operator==(const move_iterator& x, const move_iterator& y) + { return x.m_it == y.m_it; } - friend bool operator!=(const move_iterator& x, const move_iterator& y) - { return x.base() != y.base(); } + BOOST_MOVE_FORCEINLINE friend bool operator!=(const move_iterator& x, const move_iterator& y) + { return x.m_it != y.m_it; } - friend bool operator< (const move_iterator& x, const move_iterator& y) - { return x.base() < y.base(); } + BOOST_MOVE_FORCEINLINE friend bool operator< (const move_iterator& x, const move_iterator& y) + { return x.m_it < y.m_it; } - friend bool operator<=(const move_iterator& x, const move_iterator& y) - { return x.base() <= y.base(); } + BOOST_MOVE_FORCEINLINE friend bool operator<=(const move_iterator& x, const move_iterator& y) + { return x.m_it <= y.m_it; } - friend bool operator> (const move_iterator& x, const move_iterator& y) - { return x.base() > y.base(); } + BOOST_MOVE_FORCEINLINE friend bool operator> (const move_iterator& x, const move_iterator& y) + { return x.m_it > y.m_it; } - friend bool operator>=(const move_iterator& x, const move_iterator& y) - { return x.base() >= y.base(); } + BOOST_MOVE_FORCEINLINE friend bool operator>=(const move_iterator& x, const move_iterator& y) + { return x.m_it >= y.m_it; } - friend difference_type operator-(const move_iterator& x, const move_iterator& y) - { return x.base() - y.base(); } + BOOST_MOVE_FORCEINLINE friend difference_type operator-(const move_iterator& x, const move_iterator& y) + { return x.m_it - y.m_it; } - friend move_iterator operator+(difference_type n, const move_iterator& x) - { return move_iterator(x.base() + n); } + BOOST_MOVE_FORCEINLINE friend move_iterator operator+(difference_type n, const move_iterator& x) + { return move_iterator(x.m_it + n); } private: It m_it; diff --git a/include/boost/move/unique_ptr.hpp b/include/boost/move/unique_ptr.hpp index 5b06743..2d794e8 100644 --- a/include/boost/move/unique_ptr.hpp +++ b/include/boost/move/unique_ptr.hpp @@ -20,7 +20,7 @@ #endif #include -#include +#include //forceinline #include #include #include @@ -93,25 +93,25 @@ struct unique_ptr_data typedef typename deleter_types::del_ref del_ref; typedef typename deleter_types::del_cref del_cref; - unique_ptr_data() BOOST_NOEXCEPT + BOOST_MOVE_FORCEINLINE unique_ptr_data() BOOST_NOEXCEPT : m_p(), d() {} - explicit unique_ptr_data(P p) BOOST_NOEXCEPT + BOOST_MOVE_FORCEINLINE explicit unique_ptr_data(P p) BOOST_NOEXCEPT : m_p(p), d() {} - unique_ptr_data(P p, deleter_arg_type1 d1) BOOST_NOEXCEPT + BOOST_MOVE_FORCEINLINE unique_ptr_data(P p, deleter_arg_type1 d1) BOOST_NOEXCEPT : m_p(p), d(d1) {} template - unique_ptr_data(P p, BOOST_FWD_REF(U) d1) BOOST_NOEXCEPT + BOOST_MOVE_FORCEINLINE unique_ptr_data(P p, BOOST_FWD_REF(U) d1) BOOST_NOEXCEPT : m_p(p), d(::boost::forward(d1)) {} - del_ref deleter() { return d; } - del_cref deleter() const{ return d; } + BOOST_MOVE_FORCEINLINE del_ref deleter() { return d; } + BOOST_MOVE_FORCEINLINE del_cref deleter() const{ return d; } P m_p; D d; @@ -129,25 +129,25 @@ struct unique_ptr_data typedef typename deleter_types::del_ref del_ref; typedef typename deleter_types::del_cref del_cref; - unique_ptr_data() BOOST_NOEXCEPT + BOOST_MOVE_FORCEINLINE unique_ptr_data() BOOST_NOEXCEPT : D(), m_p() {} - explicit unique_ptr_data(P p) BOOST_NOEXCEPT + BOOST_MOVE_FORCEINLINE explicit unique_ptr_data(P p) BOOST_NOEXCEPT : D(), m_p(p) {} - unique_ptr_data(P p, deleter_arg_type1 d1) BOOST_NOEXCEPT + BOOST_MOVE_FORCEINLINE unique_ptr_data(P p, deleter_arg_type1 d1) BOOST_NOEXCEPT : D(d1), m_p(p) {} template - unique_ptr_data(P p, BOOST_FWD_REF(U) d) BOOST_NOEXCEPT + BOOST_MOVE_FORCEINLINE unique_ptr_data(P p, BOOST_FWD_REF(U) d) BOOST_NOEXCEPT : D(::boost::forward(d)), m_p(p) {} - del_ref deleter() BOOST_NOEXCEPT { return static_cast(*this); } - del_cref deleter() const BOOST_NOEXCEPT { return static_cast(*this); } + BOOST_MOVE_FORCEINLINE del_ref deleter() BOOST_NOEXCEPT { return static_cast(*this); } + BOOST_MOVE_FORCEINLINE del_cref deleter() const BOOST_NOEXCEPT { return static_cast(*this); } P m_p; @@ -389,7 +389,7 @@ class unique_ptr //! //! Remarks: If this constructor is instantiated with a pointer type or reference type //! for the template argument D, the program is ill-formed. - BOOST_CONSTEXPR unique_ptr() BOOST_NOEXCEPT + BOOST_MOVE_FORCEINLINE BOOST_CONSTEXPR unique_ptr() BOOST_NOEXCEPT : m_data() { //If this constructor is instantiated with a pointer type or reference type @@ -400,7 +400,7 @@ class unique_ptr //! Effects: Same as unique_ptr() (default constructor). //! - BOOST_CONSTEXPR unique_ptr(BOOST_MOVE_DOC0PTR(bmupd::nullptr_type)) BOOST_NOEXCEPT + BOOST_MOVE_FORCEINLINE BOOST_CONSTEXPR unique_ptr(BOOST_MOVE_DOC0PTR(bmupd::nullptr_type)) BOOST_NOEXCEPT : m_data() { //If this constructor is instantiated with a pointer type or reference type @@ -423,7 +423,7 @@ class unique_ptr //! - If T is not an array type and Pointer is implicitly convertible to pointer. //! - If T is an array type and Pointer is a more CV qualified pointer to element_type. template - explicit unique_ptr(Pointer p + BOOST_MOVE_FORCEINLINE explicit unique_ptr(Pointer p BOOST_MOVE_DOCIGN(BOOST_MOVE_I typename bmupd::enable_up_ptr::type* =0) ) BOOST_NOEXCEPT : m_data(p) @@ -461,7 +461,7 @@ class unique_ptr //! - If T is not an array type and Pointer is implicitly convertible to pointer. //! - If T is an array type and Pointer is a more CV qualified pointer to element_type. template - unique_ptr(Pointer p, BOOST_MOVE_SEEDOC(deleter_arg_type1) d1 + BOOST_MOVE_FORCEINLINE unique_ptr(Pointer p, BOOST_MOVE_SEEDOC(deleter_arg_type1) d1 BOOST_MOVE_DOCIGN(BOOST_MOVE_I typename bmupd::enable_up_ptr::type* =0) ) BOOST_NOEXCEPT : m_data(p, d1) @@ -474,7 +474,7 @@ class unique_ptr //! Effects: Same effects as template unique_ptr(Pointer p, deleter_arg_type1 d1) //! and additionally get() == nullptr - unique_ptr(BOOST_MOVE_DOC0PTR(bmupd::nullptr_type), BOOST_MOVE_SEEDOC(deleter_arg_type1) d1) BOOST_NOEXCEPT + BOOST_MOVE_FORCEINLINE unique_ptr(BOOST_MOVE_DOC0PTR(bmupd::nullptr_type), BOOST_MOVE_SEEDOC(deleter_arg_type1) d1) BOOST_NOEXCEPT : m_data(pointer(), d1) {} @@ -499,7 +499,7 @@ class unique_ptr //! - If T is not an array type and Pointer is implicitly convertible to pointer. //! - If T is an array type and Pointer is a more CV qualified pointer to element_type. template - unique_ptr(Pointer p, BOOST_MOVE_SEEDOC(deleter_arg_type2) d2 + BOOST_MOVE_FORCEINLINE unique_ptr(Pointer p, BOOST_MOVE_SEEDOC(deleter_arg_type2) d2 BOOST_MOVE_DOCIGN(BOOST_MOVE_I typename bmupd::enable_up_ptr::type* =0) ) BOOST_NOEXCEPT : m_data(p, ::boost::move(d2)) @@ -512,7 +512,7 @@ class unique_ptr //! Effects: Same effects as template unique_ptr(Pointer p, deleter_arg_type2 d2) //! and additionally get() == nullptr - unique_ptr(BOOST_MOVE_DOC0PTR(bmupd::nullptr_type), BOOST_MOVE_SEEDOC(deleter_arg_type2) d2) BOOST_NOEXCEPT + BOOST_MOVE_FORCEINLINE unique_ptr(BOOST_MOVE_DOC0PTR(bmupd::nullptr_type), BOOST_MOVE_SEEDOC(deleter_arg_type2) d2) BOOST_NOEXCEPT : m_data(pointer(), ::boost::move(d2)) {} @@ -526,7 +526,7 @@ class unique_ptr //! Postconditions: get() yields the value u.get() yielded before the construction. get_deleter() //! returns a reference to the stored deleter that was constructed from u.get_deleter(). If D is a //! reference type then get_deleter() and u.get_deleter() both reference the same lvalue deleter. - unique_ptr(BOOST_RV_REF(unique_ptr) u) BOOST_NOEXCEPT + BOOST_MOVE_FORCEINLINE unique_ptr(BOOST_RV_REF(unique_ptr) u) BOOST_NOEXCEPT : m_data(u.release(), ::boost::move_if_not_lvalue_reference(u.get_deleter())) {} @@ -546,7 +546,7 @@ class unique_ptr //! Postconditions: get() yields the value u.get() yielded before the construction. get_deleter() //! returns a reference to the stored deleter that was constructed from u.get_deleter(). template - unique_ptr( BOOST_RV_REF_BEG_IF_CXX11 unique_ptr BOOST_RV_REF_END_IF_CXX11 u + BOOST_MOVE_FORCEINLINE unique_ptr( BOOST_RV_REF_BEG_IF_CXX11 unique_ptr BOOST_RV_REF_END_IF_CXX11 u BOOST_MOVE_DOCIGN(BOOST_MOVE_I typename bmupd::enable_up_moveconv_constr::type* =0) ) BOOST_NOEXCEPT : m_data(u.release(), ::boost::move_if_not_lvalue_reference(u.get_deleter())) @@ -629,7 +629,7 @@ class unique_ptr //! Returns: get()[i]. //! //! Remarks::type) + BOOST_MOVE_FORCEINLINE BOOST_MOVE_DOC1ST(element_type&, typename bmupmu::add_lvalue_reference::type) operator[](std::size_t i) const BOOST_NOEXCEPT { BOOST_ASSERT( bmupmu::extent::value == 0 || i < bmupmu::extent::value ); @@ -644,7 +644,7 @@ class unique_ptr //! Note: use typically requires that T be a complete type. //! //! Remarks() const BOOST_NOEXCEPT + BOOST_MOVE_FORCEINLINE pointer operator->() const BOOST_NOEXCEPT { BOOST_STATIC_ASSERT((!bmupmu::is_array::value)); BOOST_ASSERT(m_data.m_p); @@ -653,27 +653,27 @@ class unique_ptr //! Returns: The stored pointer. //! - pointer get() const BOOST_NOEXCEPT + BOOST_MOVE_FORCEINLINE pointer get() const BOOST_NOEXCEPT { return m_data.m_p; } //! Returns: A reference to the stored deleter. //! - BOOST_MOVE_DOC1ST(D&, typename bmupmu::add_lvalue_reference::type) + BOOST_MOVE_FORCEINLINE BOOST_MOVE_DOC1ST(D&, typename bmupmu::add_lvalue_reference::type) get_deleter() BOOST_NOEXCEPT { return m_data.deleter(); } //! Returns: A reference to the stored deleter. //! - BOOST_MOVE_DOC1ST(const D&, typename bmupmu::add_const_lvalue_reference::type) + BOOST_MOVE_FORCEINLINE BOOST_MOVE_DOC1ST(const D&, typename bmupmu::add_const_lvalue_reference::type) get_deleter() const BOOST_NOEXCEPT { return m_data.deleter(); } #ifdef BOOST_MOVE_DOXYGEN_INVOKED //! Returns: Returns: get() != nullptr. //! - explicit operator bool + BOOST_MOVE_FORCEINLINE explicit operator bool #else - operator bmupd::explicit_bool_arg + BOOST_MOVE_FORCEINLINE operator bmupd::explicit_bool_arg #endif ()const BOOST_NOEXCEPT { @@ -685,7 +685,7 @@ class unique_ptr //! Postcondition: get() == nullptr. //! //! Returns: The value get() had at the start of the call to release. - pointer release() BOOST_NOEXCEPT + BOOST_MOVE_FORCEINLINE pointer release() BOOST_NOEXCEPT { const pointer tmp = m_data.m_p; m_data.m_p = pointer(); @@ -748,19 +748,19 @@ class unique_ptr //! Effects: Calls x.swap(y). //! template -inline void swap(unique_ptr &x, unique_ptr &y) BOOST_NOEXCEPT +BOOST_MOVE_FORCEINLINE void swap(unique_ptr &x, unique_ptr &y) BOOST_NOEXCEPT { x.swap(y); } //! Returns: x.get() == y.get(). //! template -inline bool operator==(const unique_ptr &x, const unique_ptr &y) +BOOST_MOVE_FORCEINLINE bool operator==(const unique_ptr &x, const unique_ptr &y) { return x.get() == y.get(); } //! Returns: x.get() != y.get(). //! template -inline bool operator!=(const unique_ptr &x, const unique_ptr &y) +BOOST_MOVE_FORCEINLINE bool operator!=(const unique_ptr &x, const unique_ptr &y) { return x.get() != y.get(); } //! Returns: x.get() < y.get(). @@ -768,99 +768,99 @@ inline bool operator!=(const unique_ptr &x, const unique_ptr &y) //! Remarks: This comparison shall induce a //! strict weak ordering betwen pointers. template -inline bool operator<(const unique_ptr &x, const unique_ptr &y) +BOOST_MOVE_FORCEINLINE bool operator<(const unique_ptr &x, const unique_ptr &y) { return x.get() < y.get(); } //! Returns: !(y < x). //! template -inline bool operator<=(const unique_ptr &x, const unique_ptr &y) +BOOST_MOVE_FORCEINLINE bool operator<=(const unique_ptr &x, const unique_ptr &y) { return !(y < x); } //! Returns: y < x. //! template -inline bool operator>(const unique_ptr &x, const unique_ptr &y) +BOOST_MOVE_FORCEINLINE bool operator>(const unique_ptr &x, const unique_ptr &y) { return y < x; } //! Returns:!(x < y). //! template -inline bool operator>=(const unique_ptr &x, const unique_ptr &y) +BOOST_MOVE_FORCEINLINE bool operator>=(const unique_ptr &x, const unique_ptr &y) { return !(x < y); } //! Returns:!x. //! template -inline bool operator==(const unique_ptr &x, BOOST_MOVE_DOC0PTR(bmupd::nullptr_type)) BOOST_NOEXCEPT +BOOST_MOVE_FORCEINLINE bool operator==(const unique_ptr &x, BOOST_MOVE_DOC0PTR(bmupd::nullptr_type)) BOOST_NOEXCEPT { return !x; } //! Returns:!x. //! template -inline bool operator==(BOOST_MOVE_DOC0PTR(bmupd::nullptr_type), const unique_ptr &x) BOOST_NOEXCEPT +BOOST_MOVE_FORCEINLINE bool operator==(BOOST_MOVE_DOC0PTR(bmupd::nullptr_type), const unique_ptr &x) BOOST_NOEXCEPT { return !x; } //! Returns: (bool)x. //! template -inline bool operator!=(const unique_ptr &x, BOOST_MOVE_DOC0PTR(bmupd::nullptr_type)) BOOST_NOEXCEPT +BOOST_MOVE_FORCEINLINE bool operator!=(const unique_ptr &x, BOOST_MOVE_DOC0PTR(bmupd::nullptr_type)) BOOST_NOEXCEPT { return !!x; } //! Returns: (bool)x. //! template -inline bool operator!=(BOOST_MOVE_DOC0PTR(bmupd::nullptr_type), const unique_ptr &x) BOOST_NOEXCEPT +BOOST_MOVE_FORCEINLINE bool operator!=(BOOST_MOVE_DOC0PTR(bmupd::nullptr_type), const unique_ptr &x) BOOST_NOEXCEPT { return !!x; } //! Requires: operator shall induce a strict weak ordering on unique_ptr::pointer values. //! //! Returns: Returns x.get() < pointer(). template -inline bool operator<(const unique_ptr &x, BOOST_MOVE_DOC0PTR(bmupd::nullptr_type)) +BOOST_MOVE_FORCEINLINE bool operator<(const unique_ptr &x, BOOST_MOVE_DOC0PTR(bmupd::nullptr_type)) { return x.get() < typename unique_ptr::pointer(); } //! Requires: operator shall induce a strict weak ordering on unique_ptr::pointer values. //! //! Returns: Returns pointer() < x.get(). template -inline bool operator<(BOOST_MOVE_DOC0PTR(bmupd::nullptr_type), const unique_ptr &x) +BOOST_MOVE_FORCEINLINE bool operator<(BOOST_MOVE_DOC0PTR(bmupd::nullptr_type), const unique_ptr &x) { return typename unique_ptr::pointer() < x.get(); } //! Returns: nullptr < x. //! template -inline bool operator>(const unique_ptr &x, BOOST_MOVE_DOC0PTR(bmupd::nullptr_type)) +BOOST_MOVE_FORCEINLINE bool operator>(const unique_ptr &x, BOOST_MOVE_DOC0PTR(bmupd::nullptr_type)) { return x.get() > typename unique_ptr::pointer(); } //! Returns: x < nullptr. //! template -inline bool operator>(BOOST_MOVE_DOC0PTR(bmupd::nullptr_type), const unique_ptr &x) +BOOST_MOVE_FORCEINLINE bool operator>(BOOST_MOVE_DOC0PTR(bmupd::nullptr_type), const unique_ptr &x) { return typename unique_ptr::pointer() > x.get(); } //! Returns: !(nullptr < x). //! template -inline bool operator<=(const unique_ptr &x, BOOST_MOVE_DOC0PTR(bmupd::nullptr_type)) +BOOST_MOVE_FORCEINLINE bool operator<=(const unique_ptr &x, BOOST_MOVE_DOC0PTR(bmupd::nullptr_type)) { return !(bmupd::nullptr_type() < x); } //! Returns: !(x < nullptr). //! template -inline bool operator<=(BOOST_MOVE_DOC0PTR(bmupd::nullptr_type), const unique_ptr &x) +BOOST_MOVE_FORCEINLINE bool operator<=(BOOST_MOVE_DOC0PTR(bmupd::nullptr_type), const unique_ptr &x) { return !(x < bmupd::nullptr_type()); } //! Returns: !(x < nullptr). //! template -inline bool operator>=(const unique_ptr &x, BOOST_MOVE_DOC0PTR(bmupd::nullptr_type)) +BOOST_MOVE_FORCEINLINE bool operator>=(const unique_ptr &x, BOOST_MOVE_DOC0PTR(bmupd::nullptr_type)) { return !(x < bmupd::nullptr_type()); } //! Returns: !(nullptr < x). //! template -inline bool operator>=(BOOST_MOVE_DOC0PTR(bmupd::nullptr_type), const unique_ptr &x) +BOOST_MOVE_FORCEINLINE bool operator>=(BOOST_MOVE_DOC0PTR(bmupd::nullptr_type), const unique_ptr &x) { return !(bmupd::nullptr_type() < x); } } //namespace movelib { diff --git a/include/boost/move/utility.hpp b/include/boost/move/utility.hpp index 8f9c20b..28de793 100644 --- a/include/boost/move/utility.hpp +++ b/include/boost/move/utility.hpp @@ -25,6 +25,7 @@ #endif #include +#include //forceinline #include #include @@ -39,7 +40,7 @@ ////////////////////////////////////////////////////////////////////////////// template - inline typename ::boost::move_detail::enable_if_c + BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_c < enable_move_utility_emulation::value && !has_move_emulation_enabled::value , typename ::boost::move_detail::add_const::type & >::type @@ -49,7 +50,7 @@ } template - inline typename ::boost::move_detail::enable_if_c + BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_c < enable_move_utility_emulation::value && has_move_emulation_enabled::value && ::boost::move_detail::is_nothrow_move_constructible_or_uncopyable::value, rv&>::type move_if_noexcept(T& x) BOOST_NOEXCEPT @@ -58,7 +59,7 @@ } template - inline typename ::boost::move_detail::enable_if_c + BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_c < enable_move_utility_emulation::value && has_move_emulation_enabled::value && ::boost::move_detail::is_nothrow_move_constructible_or_uncopyable::value , rv& @@ -69,7 +70,7 @@ } template - inline typename ::boost::move_detail::enable_if_c + BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_c < enable_move_utility_emulation::value && has_move_emulation_enabled::value && !::boost::move_detail::is_nothrow_move_constructible_or_uncopyable::value , typename ::boost::move_detail::add_const::type & @@ -80,7 +81,7 @@ } template - inline typename ::boost::move_detail::enable_if_c + BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_c < enable_move_utility_emulation::value && has_move_emulation_enabled::value && !::boost::move_detail::is_nothrow_move_constructible_or_uncopyable::value , typename ::boost::move_detail::add_const::type & @@ -125,13 +126,13 @@ #else //BOOST_MOVE_DOXYGEN_INVOKED template - typename ::boost::move_detail::enable_if_c + BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_c < ::boost::move_detail::is_nothrow_move_constructible_or_uncopyable::value, T&&>::type move_if_noexcept(T& x) BOOST_NOEXCEPT { return ::boost::move(x); } template - typename ::boost::move_detail::enable_if_c + BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_c < !::boost::move_detail::is_nothrow_move_constructible_or_uncopyable::value, const T&>::type move_if_noexcept(T& x) BOOST_NOEXCEPT { return x; } diff --git a/include/boost/move/utility_core.hpp b/include/boost/move/utility_core.hpp index 7fd1ea1..55042a9 100644 --- a/include/boost/move/utility_core.hpp +++ b/include/boost/move/utility_core.hpp @@ -26,6 +26,7 @@ #endif #include +#include //forceinline #include #include #include @@ -47,7 +48,7 @@ ////////////////////////////////////////////////////////////////////////////// template - inline typename ::boost::move_detail::enable_if_and + BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_and < T & , enable_move_utility_emulation , has_move_emulation_disabled @@ -58,7 +59,7 @@ } template - inline typename ::boost::move_detail::enable_if_and + BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_and < rv& , enable_move_utility_emulation , has_move_emulation_enabled @@ -69,7 +70,7 @@ } template - inline typename ::boost::move_detail::enable_if_and + BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_and < rv& , enable_move_utility_emulation , has_move_emulation_enabled @@ -86,7 +87,7 @@ ////////////////////////////////////////////////////////////////////////////// template - inline typename ::boost::move_detail::enable_if_and + BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_and < T & , enable_move_utility_emulation , ::boost::move_detail::is_rv @@ -97,7 +98,7 @@ } template - inline typename ::boost::move_detail::enable_if_and + BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_and < const T & , enable_move_utility_emulation , ::boost::move_detail::is_not_rv @@ -114,7 +115,7 @@ ////////////////////////////////////////////////////////////////////////////// template - inline typename ::boost::move_detail::enable_if_and + BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_and < T & , enable_move_utility_emulation , ::boost::move_detail::is_rv @@ -125,7 +126,7 @@ } template - inline typename ::boost::move_detail::enable_if_and + BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_and < typename ::boost::move_detail::add_lvalue_reference::type , enable_move_utility_emulation , ::boost::move_detail::is_not_rv @@ -140,7 +141,7 @@ } template - inline typename ::boost::move_detail::enable_if_and + BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_and < rv& , enable_move_utility_emulation , ::boost::move_detail::is_not_rv @@ -202,13 +203,13 @@ //Old move approach, lvalues could bind to rvalue references template - inline typename ::boost::move_detail::remove_reference::type && move(T&& t) BOOST_NOEXCEPT + BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::remove_reference::type && move(T&& t) BOOST_NOEXCEPT { return t; } #else //BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES template - inline typename ::boost::move_detail::remove_reference::type && move(T&& t) BOOST_NOEXCEPT + BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::remove_reference::type && move(T&& t) BOOST_NOEXCEPT { return static_cast::type &&>(t); } #endif //BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES @@ -238,17 +239,17 @@ //Old move approach, lvalues could bind to rvalue references template - inline T&& forward(typename ::boost::move_detail::identity::type&& t) BOOST_NOEXCEPT + BOOST_MOVE_FORCEINLINE T&& forward(typename ::boost::move_detail::identity::type&& t) BOOST_NOEXCEPT { return t; } #else //Old move template - inline T&& forward(typename ::boost::move_detail::remove_reference::type& t) BOOST_NOEXCEPT + BOOST_MOVE_FORCEINLINE T&& forward(typename ::boost::move_detail::remove_reference::type& t) BOOST_NOEXCEPT { return static_cast(t); } template - inline T&& forward(typename ::boost::move_detail::remove_reference::type&& t) BOOST_NOEXCEPT + BOOST_MOVE_FORCEINLINE T&& forward(typename ::boost::move_detail::remove_reference::type&& t) BOOST_NOEXCEPT { //"boost::forward error: 'T' is a lvalue reference, can't forward as rvalue."; BOOST_STATIC_ASSERT(!boost::move_detail::is_lvalue_reference::value); @@ -273,17 +274,17 @@ //Old move approach, lvalues could bind to rvalue references template - inline T&& move_if_not_lvalue_reference(typename ::boost::move_detail::identity::type&& t) BOOST_NOEXCEPT + BOOST_MOVE_FORCEINLINE T&& move_if_not_lvalue_reference(typename ::boost::move_detail::identity::type&& t) BOOST_NOEXCEPT { return t; } #else //Old move template - inline T&& move_if_not_lvalue_reference(typename ::boost::move_detail::remove_reference::type& t) BOOST_NOEXCEPT + BOOST_MOVE_FORCEINLINE T&& move_if_not_lvalue_reference(typename ::boost::move_detail::remove_reference::type& t) BOOST_NOEXCEPT { return static_cast(t); } template - inline T&& move_if_not_lvalue_reference(typename ::boost::move_detail::remove_reference::type&& t) BOOST_NOEXCEPT + BOOST_MOVE_FORCEINLINE T&& move_if_not_lvalue_reference(typename ::boost::move_detail::remove_reference::type&& t) BOOST_NOEXCEPT { //"boost::forward error: 'T' is a lvalue reference, can't forward as rvalue."; BOOST_STATIC_ASSERT(!boost::move_detail::is_lvalue_reference::value);