I was reading an older data-structures book and it said that when you’re doing template class programming you should include the .cpp at the end of the .h file.
As far as I know you have to do full function implementations in your .h file for any template class member functions – it’s due to the way the template compiler works.
The only functions I was taught could be put in a implementation file for a template class were template specialization functions i.e.: template<> Class<Type>::function_name().
Why would this book to suggest to include the .cpp at the end of the .h? is this just a way of separating the implementations into different files while getting them to compile with the header? and if so, where would you put real specializations – I’m guessing they couldn’t go in the .cpp included by the header.
Most likely the author prefers having declaration and definition in different files, I can guess this is because it makes it easier to jump between declarations and definitions.
But having “cpp” file extension is a bit confusing. Usually those files are called “ipp” for “Inline C++”.