Skip to content

Instantly share code, notes, and snippets.

@Leandros
Last active May 15, 2018 18:42
Show Gist options
  • Save Leandros/644e3a48b7c338bfde9ab666b1013c4c to your computer and use it in GitHub Desktop.
Save Leandros/644e3a48b7c338bfde9ab666b1013c4c to your computer and use it in GitHub Desktop.
How I pimpl
#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;
}
#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