diff --git a/include/boost/utility/addressof.hpp b/include/boost/utility/addressof.hpp index 48602be..ac42a51 100644 --- a/include/boost/utility/addressof.hpp +++ b/include/boost/utility/addressof.hpp @@ -47,7 +47,7 @@ template struct addressof_impl template T * addressof( T & v ) { -#if BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT( 0x610 ) ) +#if defined( __BORLANDC__ ) && BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT( 0x610 ) ) return boost::detail::addressof_impl::f( v, 0 ); @@ -58,9 +58,29 @@ template T * addressof( T & v ) #endif } +#if defined( __SUNPRO_CC ) && BOOST_WORKAROUND( __SUNPRO_CC, BOOST_TESTED_AT( 0x590 ) ) + +namespace detail +{ + +template struct addressof_addp +{ + typedef T * type; +}; + +} // namespace detail + +template< class T, std::size_t N > +typename detail::addressof_addp< T[N] >::type addressof( T (&t)[N] ) +{ + return &t; +} + +#endif + // Borland doesn't like casting an array reference to a char reference // but these overloads work around the problem. -# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) +#if defined( __BORLANDC__ ) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) template T (*addressof(T (&t)[N]))[N] { @@ -72,7 +92,7 @@ const T (*addressof(const T (&t)[N]))[N] { return reinterpret_cast(&t); } -# endif +#endif } // namespace boost