I have a templated class. I want to put the definitions of its functions in a .cpp file, how do I do this?
I have a templated class. I want to put the definitions of its functions in a .cpp file, how do I do this?
Why can’t I separate the definition of my templates class from its declaration and put it inside a .cpp file?
That said, you can separate it, e.g., into a .ipp file (or just .cpp, but the Boost .ipp convention is useful to avoid confusion), then include the implementation file in translation units where you need the template to be instantiated rather than just the forward declaration in the header.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)