Re: [boost] [lexical_cast] A non-throwing lexical cast? [Was: 5 Observations - My experience with the boost libraries]

Kim Barrett wrote:
On Mar 24, 2010, at 5:20 PM, Bruno Santos wrote:
boost::bad_lexical_cast is not derived from my_project::invalid_user_input o or whatever. This happens a lot with boost::lexical_cast.
If the user data is data that comes from a file or user interface, I agree in your assertion.
However, if it's from someone using your library, it's an obvious programming error, doing exception translation in this case is pointless.
Agreed, but the source of data in a text format that should be a numeric format is much more likely to be end-user systems and inputs rather than that created within a client application, IME.
Anyway, in my opinion, passing a boost::system::error_code as the second parameter for a non throwing version would be the best solution.
As Jeff points out, others have been here before us, and it looks like the proposed Boost.StringConvert is the result of prior discussions. Perhaps our energies would be best spent making sure that library meets our needs by being reviewers or even the review manager [one is still needed, according to the schedule]. Pete
participants (1)
-
Pete Bartlett