Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r51977 - trunk/boost/utility
From: pdimov_at_[hidden]
Date: 2009-03-25 20:06:48


Author: pdimov
Date: 2009-03-25 20:06:47 EDT (Wed, 25 Mar 2009)
New Revision: 51977
URL: http://svn.boost.org/trac/boost/changeset/51977

Log:
Try to fix array addressof failures on Sun C++.
Text files modified:
   trunk/boost/utility/addressof.hpp | 15 ++++++++++++---
   1 files changed, 12 insertions(+), 3 deletions(-)

Modified: trunk/boost/utility/addressof.hpp
==============================================================================
--- trunk/boost/utility/addressof.hpp (original)
+++ trunk/boost/utility/addressof.hpp 2009-03-25 20:06:47 EDT (Wed, 25 Mar 2009)
@@ -47,7 +47,7 @@
 
 template<class T> 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<T>::f( v, 0 );
 
@@ -58,9 +58,18 @@
 #endif
 }
 
+#if defined( __SUNPRO_CC ) && BOOST_WORKAROUND( __SUNPRO_CC, BOOST_TESTED_AT( 0x590 ) )
+
+template<class T, std::size_t N> T (*addressof(T (&t)[N]))[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<typename T,std::size_t N>
 T (*addressof(T (&t)[N]))[N]
 {
@@ -72,7 +81,7 @@
 {
    return reinterpret_cast<const T(*)[N]>(&t);
 }
-# endif
+#endif
 
 } // namespace boost
 


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