How to make a closed source for a library written using a template in C ++

After reading this article Saving function definitions of C ++ templates in a .CPP file , I know that the definition of a class using a template must be written in the file header somehow. Thus, the client user can use it by importing header files. Does this not mean that the full implementation information is disclosed to the user? Does this mean that a library written with a template should be open source?

Thanks for the help in clarifying.

+3
source share
3 answers
  • . , , , . , , .

  • , . , - , , . , , . , , , , , .

+7

, ++ . - , "open source". Microsoft MFC, . .

+4

This means that based on library templates, there is usually the source code for the source, yes. This is not particularly similar to the way open source is commonly used. Again, most good libraries provide source code anyway.

+2
source

Source: https://habr.com/ru/post/1796582/


All Articles