3 ms·
I do not think Approach 2 is sound. It proposes specialization of a template without needing to recompile the library source, implying that the specialization
by thrtythreeforty 3y ago
I do not think Approach 2 is sound. It proposes specialization of a template without needing to recompile the library source, implying that the specialization will be done only in a separate translation unit.
The standard §13.9.4 says:
> If a template [...] is explicitly specialized, a declaration of that specialization shall be reachable from every use of that specialization that would cause an implicit instantiation to take place
What's going to happen in practice is the compiler will instantiate and inline the unspecialized template in the library, and the program will silently not use the mock time. Or not, it's entirely unconstrained.