|
Boost : |
From: Paul Baxter (paul_baxter_at_[hidden])
Date: 2001-06-22 15:36:31
I think this has ben suggested before.
A possible solution that unfortunately isn't (currently) Boost license
compatible may be found at
http://www.fnal.gov/fermitools/abstracts/siunits/abstract.html
Actually they have several other packages there that look extremely useful.
ISOCXX (as someone previously noted) is a seemingly well documented attempt
as ISO conformance monitoring of various compilers rather similar to our
config policy. (
http://www.fnal.gov/docs/working-groups/fpcltf/Pkg/ISOcxx/doc/0ISOcxx.html )
It looks very good and has a lot of documentation.
Similarly there are an error logger
(http://www.fnal.gov/docs/working-groups/fpcltf/Pkg/ErrorLogger/doc/html/0Er
rorLogger.html ) and many other similar libraries to Boost e.g. tuples.
So much so that there is almost an uncanny parallel with Boost. Its a shame
efforts aren't shared between the two projects to provide high-quality
license -free class libraries.
( http://www.fnal.gov/docs/working-groups/fpcltf/fpcltf.html for something
of an overview ).
Paul Baxter
----- Original Message -----
From: <Msk_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Friday, June 22, 2001 8:23 PM
Subject: [boost] A Physical Quantity library for boost?
> Would there be any interest in a small domain library for
> boost that handles dimensions (e.g. length, mass, power)
> and units (e.g. meters, feet, furlongs) of physical
> quantities?
>
> There is a "rough draft" implementation of such a library
> at http://www.xnet.com/~msk/research/phys_quan. The
> documentation right now just consists of comments in the
> main.cpp file, which gives the general flavor of how it
> can be used, and a file that outlines the design goals.
>
> The library's main purpose is to provide compile-time
> type-safety for constants, variables, and expressions. This
> will prevent you from doing things like adding 2 meters to
> 3 kilograms, or passing a density to a procedure that expects
> a specific volume. In addition, it also provides a clean syntax
> for doing unit conversions, so that adding "2 meters +
> 3 feet" does the right thing. (It will *not* prevent you
> from adding "2 pounds of garlic + 1 pound of chocolate",
> even though that may be an equally foolish thing to do,
> since the dimensions are compatible.) Of course it uses
> templates and inlines to eliminate as much runtime overhead
> as possible. (The first preliminary performance test indicated
> that with optimization turned on there is zero overhead.)
>
> I would appreciate feedback on three main questions:
>
> 1) Is this appropriate for boost? I would expect it to be
> useful in almost any problem domain involving engineering,
> physics, chemistry, etc. -- and let's not forget Mars
> probes. :-(
>
> 2) Has this already been done? The web is awash with
> interactive unit-converters, but I've found few libraries
> aimed at programmers, and none that use C++ templates.
>
> 3) Does anyone see any fatal flaws in the general approach,
> or is there an obviously better/simpler way to do this?
> I've proposed an article about this to C/C++ Users Journal
> and would prefer that any embarrassing blunders or oversights
> be exposed on the boost list rather than in print. :-)
>
> If there is any interest in something like this, I will clean
> up the code a bit and then upload it into the boost files area.
>
> - Michael Kenniston
> mkenniston_at_[hidden]
>
> Note 1: The code has been compiled under g++ 2.95.3-4(Cygwin).
> Getting it to build under MSVC++6 will take some effort; I hope
> to get that working someday but have not yet had time to find
> work-arounds for all the MSVC template problems this library tickles.
>
> Note 2: I will be out of email contact for most of next week,
> so please don't be offended if my response to your comments
> is delayed until Sat June 30.
>
>
> Info: http://www.boost.org Unsubscribe:
<mailto:boost-unsubscribe_at_[hidden]>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk