From: Dan W. (danw_at_[hidden])
Date: 2004-01-07 23:51:46
Matthias Schabel wrote:
> Yep. It's slow to compile. I'd love to start a dialogue on
> performance issues as optimizing metaprogramming compile times is about
> as far from my domain of expertise as it gets...
I think a good starting point for reducing compile time, and more
importantly, *code-writing time* would be to shorten those names.
From your own example code in another post:
(dimensioned_quantity<Y,dimensioned_unit<si_model,pressure_ty pe> > P,
dimensioned_quantity<Y,dimensioned_unit<si_model,volume_type> > V,
dimensioned_quantity<Y,dimensioned_unit<si_model,temperature_type> > T)
"dim_qty" do for "dimensional_quantity"?, or
"dim_u" for "dimensioned_unit"?, or
"qty_t" for "quantity_type"?
Another question in my mind is what's the reason to have
"pressure_type", or "temperature_type"? Are they actually doing any work?
Another question I have is about the purpose for "si_model" above. Here
in Canada we constantly mix metric and imperial units. If one was
working on software that controls a rover on a distant planet, I can see
a good reason to restrict the units to a closed system; and I wouldn't
mind having the ability to set a compile time constant that effects such
restriction. But if I'm working on a circuit layout CAD application,
most lead-through components are dimensioned in mils (inches/1000),
while most surface-mount components are dimensioned in millimeters.
But most of all, I'd hate to have to type "si_model", "si_model",
"si_model", "si_model", "si_model",... many times a day.
Now, if my suspicions were right, that 'si_model' is not necessary, and
'quantity_type' isn't really doing anything, then, the type that they
parameterize, namely 'dimensional_unit', might be dispensable.
Couldn't the function be written simply as,
template< typename Y >
Y idealGasLaw( pascals<Y> p, litres<Y> v, kelvins<Y> t );
Kelvins should _themselves_ 'know' that they are a temperature type.
And if I threw Celsius at it, it should know what to do, too.
Just my dim_u<no_model,money_type> two_cents = 0.02 * $; :)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk