|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2008-08-22 20:46:31
on Fri Aug 22 2008, rtsweng-sw-AT-yahoo.com wrote:
>>>>That would make it possible to easily separate the compilation of
>>>>boost classes (or at least their methods) from that of user-defined
>>>>classes.
>>> No, unfortunately, it wouldn't, because you have to pull in the
>>> definitions to use the template class, what you want is precompiled
>>> headers.
>
>>This is not exactly true. I already use such an approach in my own
>>developments.
>>The idea is to use concepts to make sure that the right member
>>functions are called inside a cpp file and therefore will be compiled
>>and usable everywhere.That would mean pulling in all related
>>implementation details... But only for one compilation unit (created
>>with that purpose in mind). Other compilation units would only have
>>access to template class definitions. For that matter, i personally
>>use the .h extension for template class definitions and .hpp for
>>template class method definitions (but that's only an example of what
>>could be done).
>
>>Note that i agree that it would also bring a readability benefit to
>>the source code.
>
>>Benoît
>
>
> This sounds exactly like
> what I am trying to do, I already split the declarations into .h files
> and the definitions into .hpp. Can you give a brief example of using a
> single .cpp file for compilation? Is this done like MSVC stdafx files?
For what it's worth, the Boost convention is that all C++ filenames end
in "pp". Those who follow the convention tend to use ".ipp" files for
implementation headers.
-- Dave Abrahams BoostPro Computing http://www.boostpro.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk