diff --git a/include/boost/mpl/string.hpp b/include/boost/mpl/string.hpp index 17b29f3..7e1c648 100644 --- a/include/boost/mpl/string.hpp +++ b/include/boost/mpl/string.hpp @@ -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 +#include #include +#include #include #include #include +#include #include #include #include @@ -243,11 +250,13 @@ namespace boost { namespace mpl type; }; + #if !BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590)) template struct apply, Value, false> { typedef mpl::string<(char)Value::value> type; }; + #endif #define M0(z,n,data) \ template \ @@ -272,7 +281,19 @@ namespace boost { namespace mpl ((((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<(char)Value::value> + , type0 + >::type + type; + #else + typedef type0 type; + #endif }; }; diff --git a/test/string.cpp b/test/string.cpp index bc6e23c..f50073b 100644 --- a/test/string.cpp +++ b/test/string.cpp @@ -293,6 +293,9 @@ int main() BOOST_MPL_ASSERT((boost::is_same >)); } + BOOST_MPL_ASSERT((mpl::empty >)); + BOOST_MPL_ASSERT_NOT((mpl::empty >)); + // testing push_front { typedef mpl::push_front, mpl::char_<'a'> >::type t1; @@ -343,9 +346,6 @@ int main() mpl::for_each >(push_char(result)); BOOST_TEST("Hello world!" == result); - BOOST_MPL_ASSERT((mpl::empty >)); - BOOST_MPL_ASSERT_NOT((mpl::empty >)); - BOOST_TEST(('h' == mpl::front >::type())); BOOST_TEST(('!' == mpl::back >::type()));