
Mostafa wrote:
I'll query the dev list on the pros/cons of explicit instantiations with seperate template .ipp files vs. header only template files, right now I'm leaning against the former. If there is a general consensus that explicit instantiations are not needed, then I'll open a trak item to do away with them in the serialization/archive libraries and add what researched results I've come up with.
I used *.ipp files to factor out common code.
I used explicit instantiation for the library supported archives to minimize code bloat, and build times.
I don't see any conflict here.
Robert Ramey
I see how explicit instantiation minimizes build times, I don't see how it minimizes code bloat. In fact, it may lead to more code bloat since it's generating code for all possible combinations of template parameters the client *might* use. Where as with implicit instantiation, code is only generated for which ever combinations of template parameters the client actually uses. The only reason I was harping on explicit instantiation was that in order for me to get the portable library examples working I had to figure out what to do with the explicit instantiations that weren't compiling. (Eventually it turned out that they weren't needed.) Generally speaking, one has to manually keep track of explicit instantiations (making sure that there's one and only one instantiation for all relevant template parameters), which leads to maintainability problems vis-a-vis refactoring, like the portable library examples that weren't compiling. That's why I broached the alternative of having all template definitions "includable" by clients and having no explicit instantiations. But it's your call. I'm just broaching an alternative ... Thanks, -Mostafa