Boost logo

Boost :

From: David B. Held (dheld_at_[hidden])
Date: 2004-01-07 06:11:15


"Andy Little" <andy_at_[hidden]> wrote in message
news:btgmo3$j8h$1_at_sea.gmane.org...
> [...]
> Feel free to recode in your 'problem domain' with m and s my
> friend. I'll take my syntax .

But you didn't show the code using your syntax, so there's nothing
to compare. You show the code with your syntax, and I'll show it
with postfix units, and then we'll have apples and apples.

> BTW what about performance? Or doesnt that matter?

struct unit { };

template <typename T>
T operator*(T lhs, unit rhs) { return T; }

unit meters;

int d = 4 * meters;

I'm not saying this is how any of the libraries work, but it should give
you some idea of what is possible. Also, if your compiler can't inline
{ return T; }, you need a new compiler. At some point, you might reach
the inlining depth limit of your compiler, and then this could become
an issue. I guess you'd need profiling data to tell for sure, though.

Dave

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.556 / Virus Database: 348 - Release Date: 12/26/2003

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