Recently, I started adding more and more functions to header files, mainly for convenience. But I'm afraid I might overdo it, my headlines are full of inclusions, and I'm not sure if this is a good idea.
What are your rules of thumb for moving functions from or to header files?
In case you are interested, I’m talking about application development, not libraries.
Edit:
I think this is useful if I outlined the advantages / disadvantages of the built-in (naturally) header functions and implementation functions from my point of view:
Pro inline:
- Cleaner / concise.
- No need to duplicate a signature.
- No need to change the Makefile to link to new files.
- Instant ability to enter template parameters.
Contra inline:
- Increased compilation time (I don't care)
- Many include in headlines (shouldn't be such a big problem if they use guards)
Accordingly, it seems like a good idea to give almost all the functions in the headers, and I find it pretty close to what STL and Boost do (although they are libraries, unlike my code).
source share