Last active
May 15, 2018 18:42
-
-
Save Leandros/644e3a48b7c338bfde9ab666b1013c4c to your computer and use it in GitHub Desktop.
How I pimpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "foo.hxx" | |
struct Foo::Implementation | |
{ | |
int bar = 0; | |
}; | |
PIMPL_UNIQUE_IMPL(Foo) | |
Foo::Foo() | |
: m_impl(Construct()) | |
{} | |
int | |
Foo::GetBar() | |
{ | |
return m_impl->bar; | |
} | |
void | |
Foo::SetBar(int bar) | |
{ | |
m_impl->bar = bar; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef FOO | |
#define FOO | |
#pragma once | |
#include <a/pimpl.hxx> | |
struct Foo | |
{ | |
PIMPL_UNIQUE(Foo) | |
Foo(); | |
int | |
GetBar(); | |
void | |
SetBar(int bar); | |
}; | |
#endif /* FOO */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment