adamstark/AudioFile

Only one hpp file

xavier7179 opened this issue · 4 comments

Due to the fact that you're implementing a Template, to avoid issues with different compilers, you should consider having only one .hpp file with the full template definition there.

Hi there,

Thanks for getting in touch. Yes, I have been considering this. The downside is that one would lose the simplicity and readability of the header file at present. I am giving it some thought. :)

Could you talk me through the issues with different compilers? I know that there are issues around having to explicitly itemise types, i.e. I have added in the .cpp file...

template class AudioFile<float>;
template class AudioFile<double>;

but for this class, those are probably the only two types one would use with the library (and it wouldn't be hard to add another if need be) I don't see it as a huge issue here. I'd be interested in the compiler issues you mentioned.

Let me know your thoughts,

Best,

Adam

Well, I use this library through #include <AudioFile.cpp> instead of #include <AudioFile.h> , avoiding MSVC's compiler missing the define of the template class. If you don't want to combine the .cpp and .h file as a .hpp file, maybe it is an alternative.

The library is now a header-only library. Would be great to hear your feedback and I hope it is easier for you to use now :)