dimanche 3 janvier 2016

C++ type trait for real versus complex numbers

I am working on a C++11 quaternion library, where for certain operations, I need to make sure that the parametric type passed by the user behaves like a rael, but not a complex, and vice-versa. Has anybody written a type trait for that?

Ideally, it should be usable with std::enable_if, so have a value of true if it is e.g., int, size_t, long, float, double, ... but also boost::rational, and customer-defined types, as long as there is only one square root of the unity for that T class, I guess.

Aucun commentaire:

Enregistrer un commentaire