Looking through the list of suggested "Similar questions", it seemed those would rather like header-only stuff, and one question which does want to separate but has different problems.
I have a folder with subfolders of utility classes, a lot of them templates. They were created as part of a previous project, but clearly separate, keeping in the back of the head: "might want to reuse later".
So now I am about to make this a static library to be used by other projects. Linked it to another project, included the headers, tried to use a class template, and boom: The linker complains. Right. What was I thinking. Those class templates have separate .cpp files for the bulk of the implementation - which hardly can get baked into a library binary if no template arguments are known at this stage, and the using project only knows the headers with the declarations. The separation had good reasons, though. The implementation includes a bunch of other headers deeper down to the system, which I do not want to bother the user of the library with.
So I wonder: In current versions of C++, can you actually, in some "elegant" way, somehow make a static library, which uses class templates, while not having the user be bothered with getting lots of extra stuff included by including library headers? Of course the fact of unknown template arguments does not change. But perhaps this has been addressed in ways I'm unaware of.
I'd like to avoid the "just put it all into the header and be done" way, if possible. (concrete template parameterization for a few in-advance-known parameters as suggested in one SO post is also not workable, this needs to be generic)
There is some vague idea in the back of my head now that I could try to refactor things in a way that would make only those parts templated that really need to, and still hiding some of the nasty details from the library user. This smells like extra abstraction acrobatics, though. Although I would also welcome suggestions in this direction, if there are tried & proven recipies to do such a transform.
I have had some surprizes with current C++, so before I go that route, perhaps someone knows about one of those that might help in this case?