Boost logo

Boost :

From: Michel André (michel.andre_at_[hidden])
Date: 2002-10-19 18:52:20

"Terje Slettebø" <tslettebo_at_[hidden]> wrote in message

>> Yes of course lexical cast should be able to perform the function as
>> But that would require a newer more configurable lexical_cast with
>> specializations/traits/policies for specific conversion. But thats
>> isn't it?

>Yes. The proposal here
>( can
>extended by the user to handle any user defined conversion, via
>specialisation, or partial specialisation.
>Using the code above:
>-- 8-< code cut ----
>int main()
>std::string str=boost::lexical_cast<std::string>(std::wstring(L"Test"));
>std::wstring wstr=boost::lexical_cast<std::wstring>(std::string("Test"));
>std::cout << str << '\n';
>std::wcout << wstr << '\n';

Way cool! In a recent project I hade to make a home brewed lexical cast
because of heavy use of lexical_cast and performance issues (streams aren't
exactly known to be ligthning fast). If i had this I could have made som
careful specializations to compensate the bootlenecks in the code.

Will it be okay to do own specializations of
Isn't the detail namespace supposed to be private to the library? Maybe a
public boost::lexical_cast_impl or boost::lexical_cast_traits with an
do_cast method would be clearer.


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