|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2004-01-06 09:42:43
As moderator I'd like to request that *much* more attention be paid
to readability of posts. This is a public forum but we try to keep
our standards for information value and accessibility up. Everything
about this post, starting with the thread's subject line, is
difficult to look at. The same goes for many other posts in this
thread and in some other threads over the past few weeks.
http://www.complang.tuwien.ac.at/anton/mail-news-errors.html#line-breaks
"Andy Little" <andy_at_[hidden]> writes:
> "Dan W." <danw_at_[hidden]> wrote in message
> news:btcqro$peq$1_at_sea.gmane.org...
>> Andy Little wrote:
>> > "Dan W." <danw_at_[hidden]> wrote in message
>
>> I'd say, ints is fine, but you need numerator and denominator, I
>> suppose. But if someone tomorrow needs a non-fractional power you're
>> toast. How about making the type of the power a template parameter? Is
>> that doable?
>
> ( BTW re your prev example... You Cant use floats as template params... not
> allowed in C++:
> template< float T> // ERROR invalid template params
> class my_class; ... Why... basically (I think)
> because compile time float calcs are too tricky across compilers)
> ...Yep... my use of ints as template params is short sighted e.g:
> extract the abstract_pq from the above.
> (and for brevity use three dimension params, in sequence
> dimension-of-Length, dimension-of-Time, dimension-of-Mass)
> then it could be declared as:
> template< int L, int T, int M>
> class abstract_pq{...};
> To represent an abstract force (aside for the potential founders of the
> brave new world of physics: using SI)
> it has dimensions of length to power 1, mass to power 1,
> using ints (as above)
> abstract_pq< 1,1,-2> Force;
> notably though because ints are 'non-type template parameters' I can only
> ever use
> ints.
-- Dave Abrahams Boost Consulting www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk