Boost logo

Boost :

From: Rene Rivera (grafik666_at_[hidden])
Date: 2002-10-23 15:49:59


[2002-10-23] Paul A. Bristow wrote:

Have you considered using templates to scope the possibilities into more
flexible groups. For example...

>pi // Prefer lower case only - use uppercase only for class_names and
MACRO
>constants.
pi::value

>ln_pi // _ as separator clearer than lnpi, even if longer and hard to
type.
ln<pi>::value

>sqrt_2 // shorter than sqrt_two and clearer than sqrt2.
> // sqrt is commonly used and much shorter than square_root_2.
sqrt<2>::value

>cbrt_2 // ugly, but is C99 name.
cbrt<2>::value

>ten // can¹t be decimal digits like 10 so use a word instead.
whole<10>::value

>third // shorter than one_div_three.
inverse<3>::value

>one_div_sqrt_2 // one_div rather than reciprocal ­ short but clear.
> // _div rather than _on or _upon.
inverse<sqrt<2> >::value -- not sure if this is what you mean here

>half_pi // rather than pi_div_2.
half<pi>::value

>pi_sqr // pi_squared is rather long.
sqr<pi>::value

>two_pow_three_halves // two_pow_three_div_two is ambiguous.
??? what is it ???

>minus_ln_ln_2 // can't start with - sign so use word "minus".
neg<ln<ln<2> > >::value

>Or should it be the Interval library convention that puts the constant name
>first - an obvious plus point when making ordered lists - all the pi
constants
>will come together.
>
>pi_half // should be halved?
pi::div<2>::value
>pi_quarter // quarter_pi is nicer?
pi::div<4>::value
>pi_twice // Not as clear as two_pi?
pi::times<2>::value
>pi_thrice // Hmmm
pi::times<3>::value
>pi_four_thirds // or four_thirds_pi
pi::times<4>::div<3>::value
>pi_four_times // four_pi is much better.
>pi_times_four // four_pi is better?
pi::times<4>::value
>pi_ln // Not so clear as ln_pi?
pi::ln::value
>pi_log10 // base 10
pi::log<10>::value, or log<10>::pi::value
>pi_sqrt //
pi::sqrt::value
>pi_sqr // as above scheme.
pi::sqr::value
>pi_cbrt // ugly but C99
pi::cbrt::value
>pi_reciprocal // because can't have one_div_pi
one::div<pi>::value
>
>two // fine.
two::value
>two_sqrt // sqrt_2 or sqrt_two are much clearer.
two::sqrt::value, sqrt<two>::value, sqrt<whole<2> >::value,
whole<2>::sqrt::value
>five_cbrt // Hmmm.
???
>
>one_minus // Nasty compared to minus_one or minus_1
whole<-1>::value
>half_minus //
whole<-1>::div<2>::value, inverse<-2>::value, etc...

Just some thoughts as alternatives, not totaly informed ;-), point of view.
Take them with a grain of salt.

-- grafik - Don't Assume Anything
-- rrivera_at_[hidden] - grafik_at_[hidden]
-- 102708583_at_icq - Grafik666_at_AIM - Grafik_at_[hidden]


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