Unity builds will definitely solve most of the linker spam problem, but you should also watch out for unnecessary template instantiations. For a (simplified) real-world example, recently in my code I replaced something like this:
| struct Buffer {
uint8_t * block;
uint8_t * head;
template<typename TYPE>
void write_block(TYPE * t, size_t count) {
memcpy(head, t, count * sizeof(TYPE));
head += count * sizeof(TYPE);
}
};
|
with something like this:
| void write_block(void * mem, size_t bytes) {
memcpy(head, mem, bytes);
head += bytes;
}
|
Generating multiple equivalent versions of a template for different integer types is another common variant. This kind of mistake can be sneaky when template parameters are inferred from function arguments.