Sharing part of files without disclosing functions definition of other files


Let's say I have a C++ code with 3 libraries, A, B, and C, each containing .h, .inl, and a few .cpp files. Most of the classes and functions are templated and the libraries contain many files. Files of Library A are included in Library B, and files of libraries A and B are included in Library C. I want to hire someone to work on some files in Library B, but I don't want that person to know about the functions definitions in Library A and C. However, to compile the code, the person will need to access the .h and .inl files, and therefore access the functions définitions of the templated classes and functions. How can I go around that?

Thank you for your help!
The problem main problem is dealing with templates. So the trick is to use pre-instantiated templates. That way you can put the template implementation code in a separate .cpp file within each library, and only expose the definitions in the header file.

There's a demonstation of the technique here:
Last edited on
Topic archived. No new replies allowed.