Boost logo

Boost :

From: Matthias Troyer (troyer_at_[hidden])
Date: 2003-10-24 12:02:04


On Friday, October 24, 2003, at 04:33 PM, Jeff Flinn wrote:

>
>
> "Matthias Troyer" <troyer_at_[hidden]> wrote in message
> news:70955F59-061A-11D8-A20E-000393AD8D46_at_itp.phys.ethz.ch...
>>
>> On Friday, October 24, 2003, at 01:41 PM, Russell Hind wrote:
>>
>>> Matthias Troyer wrote:
>>>> Is it possible to have a floating point number as a template
>>>> parameter?
>>>
>>> Not sure, boost::array uses a std::size_t so don't see why not?
>>
>> I thought that the standard (14.1.4) says:
>> --------
>> A nontype template-parameter shall have one of the following
>> (optionally cvqualified) types:
>> - integral or enumeration type,
>> - pointer to object or pointer to function,
>> - reference to object or reference to function,
>> - pointer to member.
>> ----------
>> which would exclude floating point numbers
>>
>
>
> Back to rationals then?

Pointers to double are allowed, e.g. instead of

> Quantity<float, scale<1.4959855e11>, meters_t) AU

we could do

double AU_scale= 1.4959855e11;
Quantity<float, scale<&AU_scale>, meters_t) AU

which should work as long as AU_scale is a global variable or static
member variable.

Matthias


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