Boost logo

Boost :

From: Andy Little (andy_at_[hidden])
Date: 2004-01-07 06:49:18


"David B. Held" <dheld_at_[hidden]> wrote in message
news:btgpfo$o56$1_at_sea.gmane.org...
> "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.

cant do that still working on my lib...
testing bits though:

#include "C:/projects/physical_quantities/pqs.hpp"
#include "Scalar.h"
using namespace physical_quantities;
class Rotor{
public:
 Rotor();
 ~Rotor();
 Scalar<double> m_cl;
 Scalar<double> m_tsr;
 Scalar<q_length::mm> m_rotor_diameter;
 Scalar<q_length::mm> m_hub_diameter;
 Scalar<q_velocity::m_div_s> m_windspeed;
 Scalar<q_power::W> m_power_output;
 Scalar<int> m_num_blades;
 Scalar<double> m_rpm;
    Scalar<double> m_ellipticality;
    Scalar<q_mass::kg> m_mass;
    Scalar<q_length::mm> m_moment;
};

... hows that? I've shown you mine... now show me yours
or anything equivalent will do

>
> > 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.

zero runtime initialisation cost is Fact with my lib now.

regards
Andy Little


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