$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r52542 - in trunk: boost/mpl libs/mpl/test
From: eric_at_[hidden]
Date: 2009-04-22 12:36:19
Author: eric_niebler
Date: 2009-04-22 12:36:18 EDT (Wed, 22 Apr 2009)
New Revision: 52542
URL: http://svn.boost.org/trac/boost/changeset/52542
Log:
add workaround for sun
Text files modified: 
   trunk/boost/mpl/string.hpp     |    23 ++++++++++++++++++++++-                 
   trunk/libs/mpl/test/string.cpp |     6 +++---                                  
   2 files changed, 25 insertions(+), 4 deletions(-)
Modified: trunk/boost/mpl/string.hpp
==============================================================================
--- trunk/boost/mpl/string.hpp	(original)
+++ trunk/boost/mpl/string.hpp	2009-04-22 12:36:18 EDT (Wed, 22 Apr 2009)
@@ -13,11 +13,18 @@
 // $Id: string.hpp 49239 2009-04-01 09:10:26Z eric_niebler $
 // $Date: 2009-04-01 02:10:26 -0700 (Wed, 1 Apr 2009) $
 // $Revision: 49239 $
+//
+// Thanks to:
+//   Dmitry Goncharov for porting this to the Sun compiler
 
+#include <boost/config.hpp>
+#include <boost/detail/workaround.hpp>
 #include <boost/mpl/limits/string.hpp>
+#include <boost/mpl/if.hpp>
 #include <boost/mpl/char.hpp>
 #include <boost/mpl/copy.hpp>
 #include <boost/mpl/size.hpp>
+#include <boost/mpl/empty.hpp>
 #include <boost/mpl/assert.hpp>
 #include <boost/mpl/size_t.hpp>
 #include <boost/mpl/begin_end.hpp>
@@ -243,11 +250,13 @@
             type;
         };
 
+        #if !BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590))
         template<typename Value>
         struct apply<mpl::string<>, Value, false>
         {
             typedef mpl::string<(char)Value::value> type;
         };
+        #endif
 
         #define M0(z,n,data)                                                                        \
         template<BOOST_PP_ENUM_PARAMS_Z(z, n, unsigned C), typename Value>                          \
@@ -272,7 +281,19 @@
                     ((((unsigned char)Value::value)<<(BOOST_MPL_MULTICHAR_LENGTH(C0)*8))|C0)
                   , BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, C)
                 >
-            type;
+            type0;
+
+            #if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590))
+            typedef
+                typename mpl::if_<
+                    mpl::empty<mpl::string<BOOST_PP_ENUM_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, C)> >
+                  , mpl::string<(char)Value::value>
+		              , type0
+		            >::type
+		        type;
+		        #else
+		        typedef type0 type;
+		        #endif
         };
     };
 
Modified: trunk/libs/mpl/test/string.cpp
==============================================================================
--- trunk/libs/mpl/test/string.cpp	(original)
+++ trunk/libs/mpl/test/string.cpp	2009-04-22 12:36:18 EDT (Wed, 22 Apr 2009)
@@ -293,6 +293,9 @@
         BOOST_MPL_ASSERT((boost::is_same<t7, mpl::string<'aaaa','aaaa','aaaX'> >));
     }
 
+    BOOST_MPL_ASSERT((mpl::empty<mpl::string<> >));
+    BOOST_MPL_ASSERT_NOT((mpl::empty<mpl::string<'hi!'> >));
+
     // testing push_front
     {
         typedef mpl::push_front<mpl::string<>, mpl::char_<'a'> >::type t1;
@@ -343,9 +346,6 @@
     mpl::for_each<mpl::string<'Hell','o wo','rld!'> >(push_char(result));
     BOOST_TEST("Hello world!" == result);
 
-    BOOST_MPL_ASSERT((mpl::empty<mpl::string<> >));
-    BOOST_MPL_ASSERT_NOT((mpl::empty<mpl::string<'hi!'> >));
-
     BOOST_TEST(('h' == mpl::front<mpl::string<'hi!'> >::type()));
     BOOST_TEST(('!' == mpl::back<mpl::string<'hi!'> >::type()));