
AMDG Johan RĂ¥de wrote:
Zach Laine wrote:
What is your evaluation of the design?
It is very straightforward, being basically a bag of functions :). Having said that, it would be easier to use the facets in "Facets for Infinity and NaN" if I could call a single function that does the work in each of the three examples. The examples seem to indicate boilerplate code that will be repeated by most, if not all, users. It therefore make sense to me to provide convenience functions that do that work. For instance, this:
locale old_locale; locale tmp_locale(old_locale, new nonfinite_num_put<char>); locale new_locale(tmp_locale, new nonfinite_num_get<char>);
stringstream ss; ss.imbue(new_locale);
would be easier to accomplish with a convenience function like this:
stringstream ss; reasonable_function_name(ss);
If there is a technical reason why this is not possible, that would be helpful to note this near the examples.
That is of course possible, but I'm not convinced it is desirable. 1. I like to keep the interface minimal. 2. A few calls to C++ standard library functions may be easier to read than a single call to a custom function.
In any case I think that such a function does not belong in this library. It would be better to have a separate generic component. template<class Stream, class Facet...> void add_facet_to_stream_locale(Stream&, const Facet&... facet); In Christ, Steven Watanabe