Subject: Re: [boost] [forward_declare] Interest Inquiry toward Faster Compile Times
From: Olaf van der Spek (ml_at_[hidden])
Date: 2012-08-02 03:17:45
On Thu, Aug 2, 2012 at 2:36 AM, Daniel Larimer <dlarimer_at_[hidden]> wrote:
> I have been increasingly frustrated with how long it takes to compile c++ code. After spending some time in Java and C# I can feel the pain of compile times much sharper than I use to. After seeing that Java and C# were able to achieve some level of generics without requiring 'everything in the header' and knowing that C compiles an order of magnitude faster than c++ I set about to find a way to increase my compile times.
Did you try PCH (precompiled headers)?
> One of the common recommendations is to 'forward declare' everything and to use the PIMPL (private implementation pattern). Unfortunately, PIMPL usually implies heap allocation and if you ever want to return-by-value you are stuck including the entire header for the types you use in your header.
It'd be nice if a future version of C++ allowed pimpl without space overhead.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk