I want to use code from a C library (my specific example: FFTW) to implement a C++ class template. The C library defines some data types and functions that do the same thing, but on different kinds of primitive numeric types, e.g. fftw_complex (pair of doubles) vs. fftwf_complex (pair of floats); fftw_execute() vs. fftwf_execute(), and so on.
I would like to implement a class template that only depends on this primitive type, e.g.
FFT<float>, FFT<double>, FFT<long double> etc.
In this example the library follows the convention that all functions and data have the same prefix that specifies the data type they work with, so I might be able to do something very ugly with macros, but I would prefer not to.
Does anyone know of an elegant way to achieve this?
Aucun commentaire:
Enregistrer un commentaire