Boost logo

Boost Users :

Subject: Re: [Boost-users] [serialization]polymorphicportablebinaryexamplenot working.
From: Mostafa (mostafa_working_away_at_[hidden])
Date: 2010-03-16 04:56:50


> 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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net