Boost logo

Boost :

From: Andy Little (andy_at_[hidden])
Date: 2006-07-22 21:39:34


"Andy Little" wrote
> "Paul A Bristow" wrte
>>I am writing template math functions.
>>
>> Some can take integral types (only)
>>
>> Some can take real (both built-in floating-point - float, double.. AND User
>> Defined real types)
>>
>> And some can take either integral OR real.
>>
>> Real : Floating-point types
>> Integer : Integral types
>> Arithmetic : Either Integral OR Floating-point types
>>
>> Arithmetic is a bit long - other ideas?
>>
>> So to write a function something like
>>
>> template <class RealType>
>> RealType students_t(ArithmeticType degrees_of_freedom, RealType t)
>> { ...
>> }
>>
>> Using just T is not an option because there are three (at least) possibles.
>>
>> What names should I use for the types?
>
> I think they are Concepts rather than types FWIW.
>
> template <class ArithmeticType ,class RealType>
> RealType students_t(ArithmeticType degrees_of_freedom, RealType t)
> { ...
> }
>
> I assume you meant that above?
>
>> RealType, real_type, RealT, or RT, or ???
>>
>> IntType, int_type, IntT, IT, or ???
>>
>> ArithmeticType, arithmetic_type, ArithType, arith_type, AT ???
>>
>> Suggestions for names please. Rationales? Prior art? Precedents? Standards?
>>
>> Thanks
>
> Sounds to me like these Concepts and their requirements need to be written and
> put somewhere in the
> Boost Docs. . I would be happy to help, but given my
> recent form regarding Concepts, I'm probably not the best person to ask! ;-).
> Anyway I think they are needed and very useful. Maybe you should start here:
>
> http://www.boost.org/libs/concept_check/reference.htm#basic-concepts
>
> Maybe you could also use type_traits as a basis for names.

I am wondering if you had any more thoughts regarding these Concepts?
They would be very useful for the Quan http://sourceforge.net/projects/quan
documentation. and for general use.

Has anyone any thoughts on this, or better, are these Concepts defined
somewhere?

regards
Andy Little


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