In my own code I had to make static function names unique
manually.
For template code, I think the template code must be merged in
a single header file. And the source code merged in other file without
to expand the template headers. Instead it must include one merged
template file.
If I had to to this using the tool I would
do the following:
1 - Merge all includes in one file
tool merge_h.txt allheaders.h
-- merge_h.txt--
#include "header1.h"
#include "header2.h"
...
#include "headerN.h"
---
2 - Merge source files.
Headers files must not be present in this directory
to avoid expansion. They need to be included at the
beginning to avoid subsequent includes of "#include".
tool merge_cpp.txt allsource.cpp
-- merge_cpp.txt--
////////////cut here after completation ///////////////////
#include "header1.h"
#include "header2.h"
...
#include "headerN.h"
///////////cut here after completation /////////////
#include "allheaders.h"
#include "source1.cpp"
#include "source2.cpp"
...
#include "sourceN.cpp"
---
After generation allsource.cpp I would manually
remove cut here, or just use #if 0 there.
I don't have a real case for this now, but
the tool can be customized for the template needs.
I can create the "don't expand list" also to
avoid to have to remove the headers I don't want
to expand.