[lexical_cast] Volunteer testers needed

The attached file contains a modification to lexical_cast which I want to be included in Boost 1.40. However that requires testing since lexical_cast is widely used. I did my own tests but it is not enough. Thus I ask anyone willing to volunteer to use the attached code and notify about the result. The attached file should be used instead of Boost's lexical_cast. It adds boost::classic_lexical_cast which acts exactly as boost::lexical_cast with std::locale::classic as the global locale. Two things have to be tested. 1) [more important] Whether boost::lexical_cast works as previously after the changes. 2) [less important] Whether boost::classic_lexical_cast works as expected. The changes allow to use lexical_cast in locale-independent tasks (like serialization of data) through the boost::classic_lexical_cast in applications which set global locale to something else then the classic locale. Also having those changes easies possible addition of text-based conversion function talking arbitrary locale object. Thanks in advance to anyone who helps. Adam Badura

Adam Badura <abadura <at> o2.pl> writes:
The attached file contains a modification to lexical_cast which I want to be included in Boost 1.40. However that requires testing since lexical_cast is widely used. I did my own tests but it is not enough.
Hi Adam, I would prefer it's named boost::classic::lexical_cast but I'm not sure what is the policy in other boost libraries (Spirit classic comes to mind but it's classic in a some other way :) Also, it would be more efficient to use NULL p_loc for classic rather than &std::locale::classic() because you could turn #ifndef BOOST_LEXICAL_CAST_ASSUME_C_LOCALE ... #endif into if(p_loc) { ... } . Alex

I would prefer it's named boost::classic::lexical_cast but I'm not sure what is the policy in other boost libraries (Spirit classic comes to mind but it's classic in a some other way :)
I don't know it either and I have no strong feelings to this name so I can be changed if desired.
Also, it would be more efficient to use NULL p_loc for classic rather than &std::locale::classic() because you could turn
#ifndef BOOST_LEXICAL_CAST_ASSUME_C_LOCALE ... #endif
into
if(p_loc) { ... }
Yes. But first of all it would require to use &std::locale() as global locale in place of current NULL. This would mean that a copy of the locale has to be done each time lexical_cast is called. And although copying std::locale objects should be simple it still is some overhead compared to original version which did not do this. Also time of acquisition of the global locale object would be different the in the original version of lexical_cast. I think that in good written code it should not matter. However I preferred to introduce as few changes to the original lexical_cast as possible so I chose NULL to mean global locale instead of classic one. Adam Badura
participants (2)
-
Adam Badura
-
Alexander Nasonov