Skip to content

Instantly share code, notes, and snippets.

@vslaykovsky-zz
Created March 21, 2017 19:02
Show Gist options
  • Save vslaykovsky-zz/b696d18e33996908e79a12c8bda24d38 to your computer and use it in GitHub Desktop.
Save vslaykovsky-zz/b696d18e33996908e79a12c8bda24d38 to your computer and use it in GitHub Desktop.
struct array_deleter
{
void operator ()(char * p)
{
delete[] p;
}
};
class A{
public:
shared_ptr<char> a;
A() : a(new char[100], array_deleter()) {
}
};
int main(int c, char* v) {
shared_ptr<A> a(new A());
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment