Boost logo

Boost :

From: Andy Little (andy_at_[hidden])
Date: 2004-01-09 15:32:56

"Deane Yang" <deane_yang_at_[hidden]> wrote

> To answer your question "what is typeof(j / s)", you would do
> what Hugo Duncan described a long, long time ago. A unit type
> would consist of a typelist of fundamental unit tags (all user-defined,
> if I had it my way) and a rational number associated with each
> tag. Then the type of "j/s" would be a typelist
> containing a tag representing joules (with an exponent of 1) and
> another tag representing seconds (with an exponent of -1).

#include "../pqs.hpp"
#include <complex>
using namespace physical_quantities;
int main()
  q_energy::J j(1);
  q_time::s s(1);
  std::cout << j/s <<'\n';

1 W

BTW Who said my lib doesnt do D.A. ?
Have they tried it?

First rule of physics:
Prove your conjectures by testing

Andy Little

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