$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Andy Little (andy_at_[hidden])
Date: 2003-11-19 23:29:06
"Andy Little" <andy_at_[hidden]> wrote in message
news:bphd7b$efo$1_at_sea.gmane.org...
>
> "Andy Little" <andy_at_[hidden]> wrote in message
> news:bphbjf$buc$1_at_sea.gmane.org...
> [snip]
> > The programmer imposes a type on the entity when it is ouput.
> > A physical quantity consists in a concise amount of information. Keep it
> > simple.
> > e.g
> > pq_length<value_type>::m length1(1), length2(1);
> > pq_angle<value_type>::radians alpha = length1/length2;
> > pq_angle<value_type>::degrees beta = length1/length2;
>
> Hoisted on my own rope !
> It 's probably not possible to convert to degrees in that example without
a
> dimensionless type.
> You win on this one ... C'est la vie :-)
OTOH. Angles are important enough to have their own identity and should not
be dependent on the pq class.
Hence:
value_type val ;
pq_angle<value_type>::radians alpha(val); // ok
pq_angle<value_type>::degrees beta(val); // ok
pq_angle<value_type>::radians alpha = val ; // no requires explicit value
ctor
pq_angle<value_type>::degrees beta = val ; // no requires explicit value
ctor
alpha = beta; //ok
//and there is no dimensionless type :-) hence
pq_length<value_type>::m length1(1), length2(1);
value_type val = length1/length2; //ok
pq_angle<value_type>::radians alpha = length1/length2; // no requires
explicit value ctor
pq_angle<value_type>::degrees beta = length1/length2; //no requires explicit
value ctor
pq_angle<value_type>::radians alpha( length1/length2); // ok
pq_angle<value_type>::degrees beta( length1/length2); // ok
basically no direct relationship betwen angle and pq.
Let the programmer decide
regards
Andy Little