Ticket #9170: boost_addressof_forceinline.diff
File boost_addressof_forceinline.diff, 1.8 KB (added by , 9 years ago) |
---|
-
boost/utility/addressof.hpp
25 25 { 26 26 T & v_; 27 27 28 inlineaddr_impl_ref( T & v ): v_( v ) {}29 inlineoperator T& () const { return v_; }28 BOOST_FORCEINLINE addr_impl_ref( T & v ): v_( v ) {} 29 BOOST_FORCEINLINE operator T& () const { return v_; } 30 30 31 31 private: 32 32 addr_impl_ref & operator=(const addr_impl_ref &); … … 34 34 35 35 template<class T> struct addressof_impl 36 36 { 37 static inlineT * f( T & v, long )37 static BOOST_FORCEINLINE T * f( T & v, long ) 38 38 { 39 39 return reinterpret_cast<T*>( 40 40 &const_cast<char&>(reinterpret_cast<const volatile char &>(v))); 41 41 } 42 42 43 static inlineT * f( T * v, int )43 static BOOST_FORCEINLINE T * f( T * v, int ) 44 44 { 45 45 return v; 46 46 } … … 48 48 49 49 } // namespace detail 50 50 51 template<class T> T * addressof( T & v ) 51 template<class T> 52 BOOST_FORCEINLINE 53 T * addressof( T & v ) 52 54 { 53 55 #if (defined( __BORLANDC__ ) && BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT( 0x610 ) ) ) || defined( __SUNPRO_CC ) 54 56 … … 74 76 } // namespace detail 75 77 76 78 template< class T, std::size_t N > 79 BOOST_FORCEINLINE 77 80 typename detail::addressof_addp< T[N] >::type addressof( T (&t)[N] ) 78 81 { 79 82 return &t; … … 85 88 // but these overloads work around the problem. 86 89 #if defined( __BORLANDC__ ) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) 87 90 template<typename T,std::size_t N> 91 BOOST_FORCEINLINE 88 92 T (*addressof(T (&t)[N]))[N] 89 93 { 90 94 return reinterpret_cast<T(*)[N]>(&t); 91 95 } 92 96 93 97 template<typename T,std::size_t N> 98 BOOST_FORCEINLINE 94 99 const T (*addressof(const T (&t)[N]))[N] 95 100 { 96 101 return reinterpret_cast<const T(*)[N]>(&t);