From: Gennaro Prota (gennaro_prota_at_[hidden])
Date: 2002-11-01 07:37:04
On Fri, 1 Nov 2002 01:00:25 -0500, Daryle Walker <dwalker07_at_[hidden]>
>On Saturday, October 26, 2002, at 1:51 PM, Beman Dawes wrote:
>> At 02:42 AM 10/25/02, Daryle Walker wrote:
>>> As another poster on this subject has said, Roman numbers don't have
>>> different math rules, they are just a different external
>>> of natural numbers. This suggests that the place for new code is in
>>> the I/O system! We'll use a special locale with custom facets.
>> Boost libraries shouldn't always be dead serious. There should be a
>> for fun libraries too. They can be useful, too, and often make good
>> teaching examples.
>I didn't imply anything about the seriousness or levity on this
>subject. But having a "fun" project doesn't mean you should be lax on
>where to approach the problem.
Agreed. But since the roman representation is likely to be used
sporadically or at least in a few well-defined places of an
application, mostly intermixed with the normal representation, I would
not go through the create locale/imbue it onto the stream/re-imbue the
old one every time I want a little number somewhere. I would find it
quite overkilling (and awkward) even with the I/O state savers. My
preference is for a little class to be used like:
cout << roman_rep (200) << ...; // constructs a temporary and output
Simple and effective IMHO. Note that, as I said, once you make a few
design decisions the core of the code is just a 10 minutes exercise.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk