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
news:021501c277b6$0ada7f40$60fb5dd5_at_pc...

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

>Yes. The proposal here
>(http://groups.yahoo.com/group/boost/files/lexical_cast_proposition/) can
be
>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
boost::detail::lexical_cast_impl?
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.

regards
/Michel


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk