Boost logo

Boost :

From: Andy Little (andy_at_[hidden])
Date: 2004-07-22 19:08:05

"Doug Gregor" <dgregor_at_[hidden]> wrote
> On Jul 22, 2004, at 8:08 AM, Arkadiy Vertleyb wrote:


> It could just be called BOOST_DECLTYPE, with the caveat that it doesn't
> act quite perfectly for variables. Frankly, I couldn't care much less
> about variables: you rarely need the type of those, although I could
> easily contrive cases.

I want variables!
In context of my physical quantities library types resulting from calcs are
computed in non-trivial ways.
If the programmer has a complicated calculation then declaring a variable
may force a scaling

q_area::mm2 a;
q_length:: mm b;
q_length::m c = a / b;

In the above, the temporary result of a / b will be divided by 1000 in the
assign to cc, because the programmer has forced this by the l_value

auto c = a / b;

Here, the resulting units of the temporary are automatically computed., no
scaling. In this case units of millimetres( I think... all these
assertions require manual checking) would be the auto type, but the
programmer doesnt need to worry about it. ie every non-auto assignment
represents a potential loss in speed and accuracy.

This is a major potential useage of the mechanism in my physical quantities

FWIW I am very interested in BOOST_TYPEOF but unfortunately dont have time
to investigate for a couple of weeks.

Andy Little

Boost list run by bdawes at, gregod at, cpdaniel at, john at