Boost logo

Boost :

From: Dean Foster (foster_at_[hidden])
Date: 2004-01-07 22:04:37


------- Start of forwarded message -------

> Speed s = 2 m / s;

I wrote a trivial units library in which I had the default constructor
generate a standard "unit." In other words:

        meter x; // x = 1 meter.

It didn't look very nice that way, but when you:

        meter x = 3 * meter(); // x = 3 meters.

or in its even more intuitive form:

        distance x = 3 * meter();

it started looking better. I found that I got used to the "1" as the
default fairly quickly. It bugged me athestically--but it generated
code that was generally very readable.

later,

dean

=============================================================================
Dean Foster dean_at_[hidden]
Statistics, Wharton, U. Penn 215 898 8233
Philadelphia PA 19104-6340 http://gosset.wharton.upenn.edu/~foster/
 -=- MIME -=- 
--===============46187451832786364==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit

You are not allowed to post to this mailing list, and your message has
been automatically rejected. If you think that your messages are
being rejected in error, contact the mailing list owner at
boost-owner_at_lists.boost.org.

--===============46187451832786364==
Content-Type: message/rfc822
MIME-Version: 1.0

Received: from gosset.wharton.upenn.edu (gosset.wharton.upenn.edu
        [128.91.107.203])
        by heart-of-gold.osl.iu.edu (8.11.6/8.11.6) with SMTP id i082wl518044
        for <boost_at_[hidden]>; Wed, 7 Jan 2004 21:58:47 -0500
Received: (qmail 4593 invoked by uid 500); 8 Jan 2004 02:58:53 -0000
Date: 8 Jan 2004 02:58:53 -0000
Message-ID: <20040108025853.4592.qmail_at_[hidden]>
From: Dean Foster <foster_at_[hidden]>
To: boost_at_[hidden]
In-reply-to: <btgigm$bfq$1_at_[hidden]> (andy_at_[hidden])
Subject: Re: [boost] Re: physical quantities (was: runtime unit-modifiable
        ...)
References: <BAY7-F38kdkBQuYUTX400010fec_at_[hidden]>
        <btgghe$7rh$1_at_[hidden]> <btgigm$bfq$1_at_[hidden]>

> Speed s = 2 m / s;

I wrote a trivial units library in which I had the default constructor
generate a standard "unit." In other words:

        meter x; // x = 1 meter.

It didn't look very nice that way, but when you:

        meter x = 3 * meter(); // x = 3 meters.

or in its even more intuitive form:

        distance x = 3 * meter();

it started looking better. I found that I got used to the "1" as the
default fairly quickly. It bugged me athestically--but it generated
code that was generally very readable.

later,

dean

=============================================================================
Dean Foster dean_at_[hidden]
Statistics, Wharton, U. Penn 215 898 8233
Philadelphia PA 19104-6340 http://gosset.wharton.upenn.edu/~foster/

--===============46187451832786364==--


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk