> From: Shane King [mailto:Shane_King@softworks.com.au]
> Why is partial template specialisation needed to achieve this ... this
> code seems to work for me (in VS6 & VS7):
>
> template <class StringType, class InitialType>
> StringType string_cast(const InitialType &initial)
> {
>       std::basic_ostringstream<
> StringType::traits_type::char_type,
>                                               StringType::traits_type,
>
>      
> StringType::allocator_type> os;
>       os << initial;
>       return os.str();
> }
>
> Which obviates the need for the compiler to support partial template
> specialisation. Of course, PTS would be nice to allow narrow
> -> wide and
> vice versa conversions.
>

Of course, this trades partial specialization for a partial solution :) - it works (if typename is added where appropriate) for string_cast (to_string) only; the solution doesn't scale to cover lexical_cast (which the code from http://lists.boost.org/MailArchives/boost/msg27288.php aimed to do).

Bjorn Karlsson