I had a longer more complicated question and have this code <http://www.ideone.com/VEOvp>

However i'll simplify it. Is there anything wrong with the code below and is there a better way to do the below?

I am worried about this line `std::list<Plugin*>& plugins` and how to set it while keeping it a reference. But i'll let you guys pick the code apart.

```
#include <list>
#include <string>
class Plugin{
public:
    static std::list<Plugin*>*plugins;
    std::string name;
    Plugin(const std::string&n) : name(n)
    {
      static std::list<Plugin*> plugins;
      this->plugins=&plugins;
      plugins.push_back(this);
    }
};

//main.cpp
#include "plugin.h"

class Plugin1 : public Plugin{
public:
    Plugin1():Plugin("1"){}
};

static Plugin1 plugin;

std::list<Plugin*>* Plugin::plugins;
std::list<Plugin*>& plugins = *Plugin::plugins; //global name plz
int main(){
    for(auto c=plugins.cbegin(); c!=plugins.cend(); ++c) {
        printf("%s\n", (*c)->name.c_str());
    }
}

//PluginA.cpp
#include "plugin.h"

class PluginA : public Plugin{
public:
    PluginA():Plugin("A"){}
};

static PluginA plugin;

```