From 3bac7b132a3641a7ed3ffa580d682e3d13fd7fd4 Mon Sep 17 00:00:00 2001 From: Joel Falcou Date: Tue, 1 Oct 2013 15:02:28 +0000 Subject: [PATCH] Fix #9169 - Add BOOST_FORCEINLINE on boost::ref for performance issue [SVN r86124] Conflicts: include/boost/ref.hpp --- include/boost/ref.hpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/include/boost/ref.hpp b/include/boost/ref.hpp index 6058d69..1d9d3ec 100644 --- a/include/boost/ref.hpp +++ b/include/boost/ref.hpp @@ -30,7 +30,7 @@ namespace boost { template class reference_wrapper -{ +{ public: typedef T type; @@ -40,15 +40,15 @@ public: #else - explicit reference_wrapper(T& t): t_(boost::addressof(t)) {} + BOOST_FORCEINLINE explicit reference_wrapper(T& t): t_(boost::addressof(t)) {} #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: @@ -61,12 +61,12 @@ private: # define BOOST_REF_CONST const # endif -template inline reference_wrapper BOOST_REF_CONST ref(T & t) -{ +template BOOST_FORCEINLINE reference_wrapper BOOST_REF_CONST ref(T & t) +{ return reference_wrapper(t); } -template inline reference_wrapper BOOST_REF_CONST cref(T const & t) +template BOOST_FORCEINLINE reference_wrapper BOOST_REF_CONST cref(T const & t) { return reference_wrapper(t); } @@ -125,7 +125,7 @@ namespace detail { typedef char (&yes_reference_wrapper_t)[1]; typedef char (&no_reference_wrapper_t)[2]; - + no_reference_wrapper_t is_reference_wrapper_test(...); template @@ -160,7 +160,7 @@ class is_reference_wrapper bool, value = ( sizeof(detail::is_reference_wrapper_test(type())) == sizeof(detail::yes_reference_wrapper_t))); - + typedef ::boost::mpl::bool_ type; }; @@ -173,13 +173,13 @@ class unwrap_reference # endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -template inline typename unwrap_reference::type& +template BOOST_FORCEINLINE typename unwrap_reference::type& unwrap_ref(T& t) { return t; } -template inline T* get_pointer( reference_wrapper const & r ) +template BOOST_FORCEINLINE T* get_pointer( reference_wrapper const & r ) { return r.get_pointer(); }