ma740988 wrote:
void mxvmvd(double *pv1, long ninc1, double *pso, long n);
void mxvmvf( float *pv1, long ninc1, float *pso, long n);
How would I write a generic solution (template version) that'll call
the appropriate function based on the float or double type?
I've got vendor API's that has two separate functions that differ only
by 'f' (float) or 'd' (double). My intent is to put a wrappers around
these functions. I tempted to do a typeid 'check' but I'm unsure if
that's necessary/is the right approach.
You could use a template, but all you need is an overload:
void mxvmv(double *pv1, long ninc1, double *pso, long n)
{ mxvmvd(pv1, ninc1, pso, n); }
void mxvmv( float *pv1, long ninc1, float *pso, long n);
{ mxvmvd(pv1, ninc1, pso, n); }
You are looking at a C-style overload, so the simplest wrapper is a real C++
overload.
--
Phlip
http://www.greencheese.org/ZeekLand <-- NOT a blog!!!