Skip to content

Instantly share code, notes, and snippets.

@siritori
Created January 29, 2013 23:15
Show Gist options
  • Save siritori/4668917 to your computer and use it in GitHub Desktop.
Save siritori/4668917 to your computer and use it in GitHub Desktop.
なんでエラーでるんー
#include <iostream>
#include <list>
#include <memory>
class hoge;
typedef std::shared_ptr<hoge> hoge_ptr;
class hoge
{
public:
hoge(const int x):x_(x)
{
hoges.push_back(hoge_ptr(this));
}
private:
int x_;
static std::list<hoge_ptr> hoges;
};
std::list<hoge_ptr> hoge::hoges;
int main()
{
hoge x(5);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment