Adding Global and Specialized Functions
Nontemplatized Global Functions Most global functions are templatized and should work with both built-in or user-defined types. Due to limitations in the way some compilers implement templates, however, some global functions cannot be templatized, or must be specialized for other reasons.
Primarily this occurs in functions whose return type is different than the input type; for example,
abs(RWMathVec<DComplex>) returns an
RWMathVec<double>. Also, a few template functions must be specialized for
DComplex. As compilers come closer to implementing the Standard C++ Library, these functions will become template functions with their return type defined by
rw_numeric_traits.
For functions which are not templatized, you don't need to add all global functions for your numeric type, but only those you want to use. Functions which have been specialized, or are not templatized, are in the Global Functions.
Templatized Global Functions Some fully templatized functions which operate on the collection classes on a per-element basis, as the trigonometric functions do, assume that the corresponding function is defined for your numeric type. When you use templatized global functions which assume corresponding defined functions, you must be sure to provide them. For example, to compute sin(RWMathVec< Quaternion<double> >), the function sin(Quaternion<double>) must be defined.