|
Boost : |
From: Ralf W. Grosse-Kunstleve (rwgk_at_[hidden])
Date: 2002-01-20 08:33:19
(This question is related to my previous posting.)
Here is something I am often wondering about:
template <typename NumVectorType>
NumVectorType operator*(const NumVectorType& lhs, const NumVectorType& rhs);
Is there a way to classify or register types as NumVectorTypes?
I know how to make a distinction between types once I am
/inside/ the function (using traits). However, what I am
after is something like:
tell_compiler {
possible typename NumType:
double
float
etc.
possible typename NumVectorType:
std::vector<NumType>
boost::array<NumType, *>
etc.
}
Then the compiler should select template functions only if the
concrete type is registered under the typename label.
Is this asking for a formalization of "concepts?"
To which degree can this be emulated with the language as-is?
What can we expect in the future (from the standard committee)?
Thanks,
Ralf
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk