Boost logo

Boost :

From: Dan W. (danw_at_[hidden])
Date: 2004-01-08 13:36:26


Matthias Schabel wrote:
> I don't really know about compile time reduction - a smart compiler
> will undoubtedly use a hash of some sort to reduce names into integers
> or something more manageable...

AFAIK, names are lenghtened, not shortened; only eventually being
resolved to addresses, etc. Hash tables and the like are used for
look-up's, but a full name is still required for equality comparison;
and so that doesn't cure the problem of compile-time memory use, which
bears on efficiency of use of hardware cache.

> and have all the internal stuff done in SI. I have thought about the
> possibility of doing away with unit models entirely - the only problem
> is then you need to define some absolute reference for conversions

I'm not sure I understand the need for an absolute reference. Couldn't
each unit BE its own absolute reference? Inside meters, 1 m == 1; inside
mm, 1 mm == 1. Conversion functions could be non-class functions:

template< U, V >
void convert( U&, V ){ assert(0); }
template <>
void convert<m,mm>( x,y ){ x = 0.001 * y; }
template <>
void convert<mm,m>( x,y ){ x = 1000.0 * y; }

then
template< typename Z >
m::operator=( Z z ){ convert( *this, z ); }

Assume we forget about systems, there's not even a need for Celsius to
know that they are temperatures, as long as they are interconvertible
with Kelvins. Just my $.015.

Cheers!


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