|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r86125 - trunk/boost/utility
From: joel.falcou_at_[hidden]
Date: 2013-10-01 11:05:40
Author: jfalcou
Date: 2013-10-01 11:05:39 EDT (Tue, 01 Oct 2013)
New Revision: 86125
URL: http://svn.boost.org/trac/boost/changeset/86125
Log:
Fix #9170 - Add BOOST_FORCEINLINE in address_of for performance issues
Text files modified:
trunk/boost/utility/addressof.hpp | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
Modified: trunk/boost/utility/addressof.hpp
==============================================================================
--- trunk/boost/utility/addressof.hpp Tue Oct 1 11:02:28 2013 (r86124)
+++ trunk/boost/utility/addressof.hpp 2013-10-01 11:05:39 EDT (Tue, 01 Oct 2013) (r86125)
@@ -25,8 +25,8 @@
{
T & v_;
- inline addr_impl_ref( T & v ): v_( v ) {}
- inline operator T& () const { return v_; }
+ BOOST_FORCEINLINE addr_impl_ref( T & v ): v_( v ) {}
+ BOOST_FORCEINLINE operator T& () const { return v_; }
private:
addr_impl_ref & operator=(const addr_impl_ref &);
@@ -34,13 +34,13 @@
template<class T> struct addressof_impl
{
- static inline T * f( T & v, long )
+ static BOOST_FORCEINLINE T * f( T & v, long )
{
return reinterpret_cast<T*>(
&const_cast<char&>(reinterpret_cast<const volatile char &>(v)));
}
- static inline T * f( T * v, int )
+ static BOOST_FORCEINLINE T * f( T * v, int )
{
return v;
}
@@ -48,7 +48,9 @@
} // namespace detail
-template<class T> T * addressof( T & v )
+template<class T>
+BOOST_FORCEINLINE
+T * addressof( T & v )
{
#if (defined( __BORLANDC__ ) && BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT( 0x610 ) ) ) || defined( __SUNPRO_CC )
@@ -74,6 +76,7 @@
} // namespace detail
template< class T, std::size_t N >
+BOOST_FORCEINLINE
typename detail::addressof_addp< T[N] >::type addressof( T (&t)[N] )
{
return &t;
@@ -85,12 +88,14 @@
// but these overloads work around the problem.
#if defined( __BORLANDC__ ) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
template<typename T,std::size_t N>
+BOOST_FORCEINLINE
T (*addressof(T (&t)[N]))[N]
{
return reinterpret_cast<T(*)[N]>(&t);
}
template<typename T,std::size_t N>
+BOOST_FORCEINLINE
const T (*addressof(const T (&t)[N]))[N]
{
return reinterpret_cast<const T(*)[N]>(&t);
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk