Ticket #9170: boost_addressof_forceinline.diff

File boost_addressof_forceinline.diff, 1.8 KB (added by Mathias Gaunard, 9 years ago)

patch to add BOOST_FORCEINLINE to critical boost::addressof functions

  • boost/utility/addressof.hpp

     
    2525{
    2626    T & v_;
    2727
    28     inline addr_impl_ref( T & v ): v_( v ) {}
    29     inline operator T& () const { return v_; }
     28    BOOST_FORCEINLINE addr_impl_ref( T & v ): v_( v ) {}
     29    BOOST_FORCEINLINE operator T& () const { return v_; }
    3030
    3131private:
    3232    addr_impl_ref & operator=(const addr_impl_ref &);
     
    3434
    3535template<class T> struct addressof_impl
    3636{
    37     static inline T * f( T & v, long )
     37    static BOOST_FORCEINLINE T * f( T & v, long )
    3838    {
    3939        return reinterpret_cast<T*>(
    4040            &const_cast<char&>(reinterpret_cast<const volatile char &>(v)));
    4141    }
    4242
    43     static inline T * f( T * v, int )
     43    static BOOST_FORCEINLINE T * f( T * v, int )
    4444    {
    4545        return v;
    4646    }
     
    4848
    4949} // namespace detail
    5050
    51 template<class T> T * addressof( T & v )
     51template<class T>
     52BOOST_FORCEINLINE
     53T * addressof( T & v )
    5254{
    5355#if (defined( __BORLANDC__ ) && BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT( 0x610 ) ) ) || defined( __SUNPRO_CC )
    5456
     
    7476} // namespace detail
    7577
    7678template< class T, std::size_t N >
     79BOOST_FORCEINLINE
    7780typename detail::addressof_addp< T[N] >::type addressof( T (&t)[N] )
    7881{
    7982    return &t;
     
    8588// but these overloads work around the problem.
    8689#if defined( __BORLANDC__ ) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
    8790template<typename T,std::size_t N>
     91BOOST_FORCEINLINE
    8892T (*addressof(T (&t)[N]))[N]
    8993{
    9094   return reinterpret_cast<T(*)[N]>(&t);
    9195}
    9296
    9397template<typename T,std::size_t N>
     98BOOST_FORCEINLINE
    9499const T (*addressof(const T (&t)[N]))[N]
    95100{
    96101   return reinterpret_cast<const T(*)[N]>(&t);