I saw some code in which the developer defined a class template in a .h file, and defined its methods in a .hpp file. This caught me a bit by surprise.
Are there are
Typically (in my experience, YMMV) an hpp
file is an #include
-ed CPP file. This is done in order to break the code up in to two physical files, a primary include and an implementation-details file that the users of your library don't need to know about. It is done like this:
#include
)template<...> class MyGizmo
{
public:
void my_fancy_function();
};
#include "super_lib_implementation.hpp"
#include
this directly)template<...> void MyGizmo<...>::my_fancy_function()
{
// magic happens
}