The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. September 21, 2019, 06:38:31 AM

Login with username, password and session length


Pages: [1]
  Print  
Author Topic: PImpl  (Read 2227 times)
m0nkeymafia
Expert
****
Offline Offline

Posts: 240


Check it!


View Profile
« on: September 03, 2007, 07:45:01 AM »

Not PIMP but PImpl.
Basically a set of methodologies to make your C++ apps build a lot faster using forward declarations and hiding certain implementations.

The main premise is removing includes from your header file.

i.e. if i have a class like so
#include "a.h"

class b
{
public:
a *GetClassA() const;

private:
a * m_MyClassA;
}

In this example the a header file does not need to be included, it can be forward declared like so:
class a;

this means when you compile this header file does not depend on "a" making it much faster to compile.

Sometimes though this cannot be achieved and you need to hide implementations using a...PIMPL! Yay
i.e.
class foo
{
....
struct *PImpl;
PImpl *m_PImpl;
}

in your /.cpp file you would then flesh out the content of the PImpl i.e.
struct PImpl
{
class a;
class b;
class c;
}

Im crap at explaining so maybe a google search is in order, but very useful and drastically reduces build times!
Logged

I am Tyler Durden
Pages: [1]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!