0

I am writing a header-only library, using only .hpp and .ipp files. And I have to #include some standard libraries sometimes.

But it becomes costly for the IDEs to parse everything and show the user for suggestions. I do not want to split my definitions and implementations, because I am trying to write a header-only library.

I could not come to a wise solution to overcome this issue. Is there a practical method to follow for such situations?

Thanks in advance.

  • There is no way to accomplish that. You either expose everything or don't make a header-only library. – molbdnilo Jul 10 '20 at 11:03
  • Some library authors offer a preprocessor dispatch, e.g. `#define MY_TOKEN`, then `#include "mylib.h"` in e.g. `mylibimpl.cpp`. Your headers can then behave differently depending on `MY_TOKEN`, and users are able to pull the heavy lifting/compile times into a source file of their choice. – lubgr Jul 10 '20 at 11:06

0 Answers0