Re: [boost] Formal Review Request: Boost.Convert

Stewart, Robert wrote...
I assume that's a reference to me. My suggestion of "conversion" was as a namespace name. Were you referring to my suggestion of using "converter" for the function object and "convert" for the function template that would deduce template parameters?
Yes, I was referring to that latter suggestion of yours:
namespace boost { ...class convert;
s/convert/converter/ ... template <class TypeOut, class TypeIn> TypeOut const convert(TypeIn _input, TypeOut const & _default) { return converter<TypeIn,TypeOut>(_input, _default); }
I've essentially implemented function wrappers as you suggested. Only I called them convert_to() and convert_from() that I am hoping many people will be happy with (remembering string_to/from et al) as the names could not be any clearer: int i = convert_to<int>(str); int i = convert_from(str, -1); int i = convert_from<string, double>(str, -1); That allowed me to keep the function object as "convert" and, say, apply it to algorithms as std::transform( strings.begin(), strings.end(), std::back_inserter(integers), convert<string, int>(string(), -1) >> std::hex); which is kinda nice as well. Do you agree? Thanks, Vladimir.
participants (1)
-
Vladimir.Batov@wrsa.com.au