
"Jeff Garland" <jeff@crystalclearsoftware.com> wrote in message news:44F4796E.4030406@crystalclearsoftware.com...
Just to give you the flavor of how this actually needs to look, here's some code to output a 'date duration' type:
template <class CharT, class TraitsT> inline std::basic_ostream<CharT, TraitsT>& operator<<(std::basic_ostream<CharT, TraitsT>& os, const date_duration& dd) { boost::io::ios_flags_saver iflags(os); typedef boost::date_time::date_facet<date, CharT> custom_date_facet; std::ostreambuf_iterator<CharT> output_itr(os); if (std::has_facet<custom_date_facet>(os.getloc())) std::use_facet<custom_date_facet>(os.getloc()).put(output_itr, os, os.fill(), dd); else { custom_date_facet* f = new custom_date_facet(); std::locale l = std::locale(os.getloc(), f); os.imbue(l); f->put(output_itr, os, os.fill(), dd);
} return os; }
As you can see it's reasonably complex to output what amounts to an integer across wide streams and with customizeable formats. But really, output is trivial compared to input.
I also think that this is kind of funny. On the one hand you provide the pretty complex code just to output a date, OTOH it seems that the Boost.Units ( not now physical units afaics, certainly not Quan anyway) library is now required to provide a generic output for any unit, including AFAICS, money, physical quantities, network data, not forgetting apples and oranges, per hour of course. and presumably with as much flexibility on each entity as the above. Good luck with that ! regards Andy Little