We are in the process of developing a new C ++ library and decided to go based on templates, as well as with some specific specializations of a partial template for corner cases. In particular, it will be a header-only template library .
Currently, there is some concern that this will lead to a lot of duplication of code in binary files, since the library of this template will be compiled into any other shared library or executable file that uses it (maybe only those parts that are used ) I still think this is not a problem (in particular, the compiler can even embed those things that it cannot use for the borders of the shared library).
However, since we know the final set of types for which it will be used, is there a way to compile this header into a library and provide another header only with declarations and nothing else? Please note that the library should contain not only general implementations, but also partial specializations.
c ++ templates shared-libraries
lytenyn
source share