In a project of C++ utility functions I am hand rolling for personal use, I am grouping functions for parts of the library in two files. So for a digitmanip
toolset there's I am separating the source and header code in this manner:
src/digitmanip.cpp -> include/digitmanip.hpp (functions for manipulating numbers and their digits)
src/add.cpp -> include/add.hpp (a set of adding functions for containers, varargs, etc...)
This structure I've used before and works well, but I would like to have all of the functions under a namespace libname
. Can I keep the source/header separation the same while keeping everything under the same namespace?
Yes, C++ namespaces are additive. So you can extend any namespace in any file.