From: Ben Strasser (strasser.ben_at_[hidden])
Date: 2006-08-29 15:07:19
Jeff Garland <jeff <at> crystalclearsoftware.com> writes:
> > typedef unit<length, "m"> meter;
> This isn't valid code...can't give char strings to templates.
I was talking about an ideal world. ;)
> The problem is hardcoding the "m" anywhere -- this shouldn't be done. You
> need an I/O facet that has the defaults and can be overridden by the user at
> runtime. This allows different output for the same value in the same process.
> Your view of how to solve this is on the wrong course in my view...
I depends on the situation. Some units are unique to the application. Here we
probably wont need any internationalization so hard coding "m" will do the job
There are however also other units. For example length units. It might be useful
to let the programmer use meters in his program and have it output feet based on
the local in the stream.
What I mean is something like:
cout.imbue(new unit_out_facet<length, feet>("", "ft"));
wcout.imbue(new unit_wout_facet<length, feet>(L"", L"ft"));
cout.imbue(new unit_out_facet<length, meter>("", "m"));
wcout.imbue(new unit_wout_facet<length, meter>(L"", L"m"));
cout<<meter(4); // will print meter or feet based on the current local
This seems as a good idea to me and this is possbile to implement.
Input would be a bit more tricky.
> Don't take this as criticism -- I suppose I could have taken this on by now
> given my experience. I'm just hoping someone will take up my challenge
No, I don't. I like hearing other peoples opinions.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk