diff options
Diffstat (limited to 'boost/lexical_cast/try_lexical_convert.hpp')
-rw-r--r-- | boost/lexical_cast/try_lexical_convert.hpp | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/boost/lexical_cast/try_lexical_convert.hpp b/boost/lexical_cast/try_lexical_convert.hpp index 1881cdf371..b079fd42ae 100644 --- a/boost/lexical_cast/try_lexical_convert.hpp +++ b/boost/lexical_cast/try_lexical_convert.hpp @@ -1,6 +1,6 @@ // Copyright Kevlin Henney, 2000-2005. // Copyright Alexander Nasonov, 2006-2010. -// Copyright Antony Polukhin, 2011-2014. +// Copyright Antony Polukhin, 2011-2016. // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -57,8 +57,15 @@ namespace boost { : boost::true_type {}; + // Sun Studio has problem with partial specialization of templates differing only in namespace. + // We workaround that by making `is_booststring` trait, instead of specializing `is_stdstring` for `boost::container::basic_string`. + template<typename T> + struct is_booststring + : boost::false_type + {}; + template<typename CharT, typename Traits, typename Alloc> - struct is_stdstring< boost::container::basic_string<CharT, Traits, Alloc> > + struct is_booststring< boost::container::basic_string<CharT, Traits, Alloc> > : boost::true_type {}; @@ -111,13 +118,20 @@ namespace boost { : boost::true_type {}; + // Sun Studio has problem with partial specialization of templates differing only in namespace. + // We workaround that by making `is_char_array_to_booststring` trait, instead of specializing `is_char_array_to_stdstring` for `boost::container::basic_string`. + template<typename Target, typename Source> + struct is_char_array_to_booststring + : boost::false_type + {}; + template<typename CharT, typename Traits, typename Alloc> - struct is_char_array_to_stdstring< boost::container::basic_string<CharT, Traits, Alloc>, CharT* > + struct is_char_array_to_booststring< boost::container::basic_string<CharT, Traits, Alloc>, CharT* > : boost::true_type {}; template<typename CharT, typename Traits, typename Alloc> - struct is_char_array_to_stdstring< boost::container::basic_string<CharT, Traits, Alloc>, const CharT* > + struct is_char_array_to_booststring< boost::container::basic_string<CharT, Traits, Alloc>, const CharT* > : boost::true_type {}; @@ -151,9 +165,10 @@ namespace boost { typedef boost::mpl::bool_< boost::detail::is_xchar_to_xchar<Target, src >::value || boost::detail::is_char_array_to_stdstring<Target, src >::value || + boost::detail::is_char_array_to_booststring<Target, src >::value || ( boost::is_same<Target, src >::value && - boost::detail::is_stdstring<Target >::value + (boost::detail::is_stdstring<Target >::value || boost::detail::is_booststring<Target >::value) ) || ( boost::is_same<Target, src >::value && |