Fix #9169 - Add BOOST_FORCEINLINE on boost::ref for performance issue

[SVN r86124]

Conflicts:
	include/boost/ref.hpp
This commit is contained in:
Joel Falcou 2013-10-01 15:02:28 +00:00 committed by Peter Dimov
parent 9382b69eb1
commit 3bac7b132a

View File

@ -30,7 +30,7 @@ namespace boost
{ {
template<class T> class reference_wrapper template<class T> class reference_wrapper
{ {
public: public:
typedef T type; typedef T type;
@ -40,15 +40,15 @@ public:
#else #else
explicit reference_wrapper(T& t): t_(boost::addressof(t)) {} BOOST_FORCEINLINE explicit reference_wrapper(T& t): t_(boost::addressof(t)) {}
#endif #endif
operator T& () const { return *t_; } BOOST_FORCEINLINE operator T& () const { return *t_; }
T& get() const { return *t_; } BOOST_FORCEINLINE T& get() const { return *t_; }
T* get_pointer() const { return t_; } BOOST_FORCEINLINE T* get_pointer() const { return t_; }
private: private:
@ -61,12 +61,12 @@ private:
# define BOOST_REF_CONST const # define BOOST_REF_CONST const
# endif # endif
template<class T> inline reference_wrapper<T> BOOST_REF_CONST ref(T & t) template<class T> BOOST_FORCEINLINE reference_wrapper<T> BOOST_REF_CONST ref(T & t)
{ {
return reference_wrapper<T>(t); return reference_wrapper<T>(t);
} }
template<class T> inline reference_wrapper<T const> BOOST_REF_CONST cref(T const & t) template<class T> BOOST_FORCEINLINE reference_wrapper<T const> BOOST_REF_CONST cref(T const & t)
{ {
return reference_wrapper<T const>(t); return reference_wrapper<T const>(t);
} }
@ -125,7 +125,7 @@ namespace detail
{ {
typedef char (&yes_reference_wrapper_t)[1]; typedef char (&yes_reference_wrapper_t)[1];
typedef char (&no_reference_wrapper_t)[2]; typedef char (&no_reference_wrapper_t)[2];
no_reference_wrapper_t is_reference_wrapper_test(...); no_reference_wrapper_t is_reference_wrapper_test(...);
template<typename T> template<typename T>
@ -160,7 +160,7 @@ class is_reference_wrapper
bool, value = ( bool, value = (
sizeof(detail::is_reference_wrapper_test(type<T>())) sizeof(detail::is_reference_wrapper_test(type<T>()))
== sizeof(detail::yes_reference_wrapper_t))); == sizeof(detail::yes_reference_wrapper_t)));
typedef ::boost::mpl::bool_<value> type; typedef ::boost::mpl::bool_<value> type;
}; };
@ -173,13 +173,13 @@ class unwrap_reference
# endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION # endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
template <class T> inline typename unwrap_reference<T>::type& template <class T> BOOST_FORCEINLINE typename unwrap_reference<T>::type&
unwrap_ref(T& t) unwrap_ref(T& t)
{ {
return t; return t;
} }
template<class T> inline T* get_pointer( reference_wrapper<T> const & r ) template<class T> BOOST_FORCEINLINE T* get_pointer( reference_wrapper<T> const & r )
{ {
return r.get_pointer(); return r.get_pointer();
} }