
Jeff Garland <jeff <at> crystalclearsoftware.com> writes:
On the right track, but this scares me a bit. I'm not sure I want conversions in the facet code. I think I'd rather the user do that explicitly.
Actually if a global implicit conversion has been explicity made avaiable by the user then the facet code will use it. What should happen if the user tries to print a unit for which no pre- and postfix facet is in the locale? Should it fail or just print the raw number type without them. For the moment (on my local disk) it's implemented as the later but I will likly change that.
Input is much harder...because you only have access to an input iterator. You can't backtrack. So suppose you want to handle input like this: 10 m 10 meters 10 microseconds
The first 2 are a valid length -- the last isn't. Anyway, it's sticky. Why isn't the last valid?
Anyway, do you have any tips on how to parse such things? All I can think of breaks in certain situations. Perhaps I should only provide textual represenations I/O and let user handle this with getline or somthing similar. Not very elegant.