Are you using solaris studio 12.3 or older?
Before version 12.4 there was a bug where partial specialization for templates with same name but in different namespaces (basic_string in std:: and boost::container:: in this case) was considered ambiguous.

A workaround for this problem (I would recommend using solaris studio 12.4) can be found here: https://community.oracle.com/thread/3706125

2015-12-22 19:31 GMT+01:00 <dariomt@gmail.com>:
Trying to compile file libs/date_time/src/gregorian/greg_month.cpp I get an error related to Boost.LexicalCast.

I have reduced the problem to a minimal test case:

#include <string>
#include <boost/lexical_cast.hpp>

void f(const char* s)
{
    std::string s1(boost::lexical_cast<std::string>(s));
}

My feeling is that this compiler has problems in the specializations for boost::detail::is_stdstring and boost::detail::is_char_array_to_stdstring.

If I remove all those specializations the error goes away. I assume this is not the perfect solution because I guess this will miss some optimization of lexical_cast, but at least I can compile it this way  :(

Is there a better solution for this?
Has this problem been fixed in 1.60?


Error message (full instantiation stack available if needed):

"/ThirdPartyLibs/boost/1_59_0/boost/lexical_cast/try_lexical_convert.hpp", line 146: Error: Ambiguous partial specialization for boost::detail::is_char_array_to_stdstring<std::string, const char*>, boost::detail::is_char_array_to_stdstring<boost::container::basic_string<boost::detail::CharT, boost::detail::Traits, boost::detail::Alloc>, const boost::detail::CharT*> and boost::detail::is_char_array_to_stdstring<std::basic_string<boost::detail::CharT, boost::detail::Traits, boost::detail::Alloc>, const boost::detail::CharT*>.
"/ThirdPartyLibs/boost/1_59_0/boost/lexical_cast.hpp", line 42:     Where: While instantiating "boost::conversion::detail::try_lexical_convert<std::string, const char*>(const char*const&, std::string &)".


"/ThirdPartyLibs/boost/1_59_0/boost/lexical_cast/try_lexical_convert.hpp", line 134: Error: Ambiguous partial specialization for boost::detail::is_stdstring<std::string>, boost::detail::is_stdstring<boost::container::basic_string<boost::detail::CharT, boost::detail::Traits, boost::detail::Alloc>> and boost::detail::is_stdstring<std::basic_string<boost::detail::CharT, boost::detail::Traits, boost::detail::Alloc>>.
"/ThirdPartyLibs/boost/1_59_0/boost/lexical_cast.hpp", line 42:     Where: While instantiating "boost::conversion::detail::try_lexical_convert<std::string, const char*>(const char*const&, std::string &)".



_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users