Boost logo

Boost :

From: Shane King (Shane_King_at_[hidden])
Date: 2002-04-07 18:20:49

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)

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.

-----Original Message-----
From: Mattias Flodin [mailto:flodin_at_[hidden]]
Sent: Saturday, 6 April 2002 5:54 PM
To: boost_at_[hidden]
Subject: Re: [boost] Proposal: string_cast

When you do, please try not to leave the Unicode question out of the
discussion. A separate name such as to_wstring seems insufficient to me
there are times when you cannot know beforehand whether the string type
casting to is single-byte or Unicode (e.g. when writing generic code). I
posted a plausible solution (using partial specialization on the
character type) before in

Boost list run by bdawes at, gregod at, cpdaniel at, john at