Q:

how to add std::shared_ptr to multiple STL containers? 

What is the correct way of passing shared pointers to stl containers in different objects, so there is no early destruction of the object? 
I have multiple Systems with std::queue in them:
class System {
    typedef std::shared_ptr<Event> EventPtr;
protected:
    std::queue<EventPtr> mEventQueue;

    static SystemManager * sSystemManager;
   //this holds all the systems in the application

public:
    System();
    ~System();

    void addEventToQueue(EventPtr event) {
        mEventQueue.push(event);
    }

    void callEventQueue() {
        while(!mEventQueue.empty()) {
           acceptEvent(mEventQueue.front().get());
           mEventQueue.pop();
         }
    }

    void acceptEvent(Event * event);

public:
    static void sendEvent(EventPtr &event) {
        for(auto system : sSystemManager->getSystems()) {
               system->addEventToQueue(event);
        }
    }
};

I want to know if I understand it properly:
When I call System::sendEvent(std::make_shared<Event>("testEvent")); in a scope, it passes the shared pointer as a reference which doesn't create a new one and doesn't increase the reference count.  However, the addEventToQueue function passes the argument as an object, so the reference count increases; If I have 5 systems, the reference count will be 6 (counting the std::make_shared itself).  But where is this reference count stored?  Is it the first shared pointer that's created through std::make_shared?  Or is the same count in all the objects?  So, when the first objects goes out scope what happens to the other objects?  How do they know what the correct reference count is since they only know about the "parent" object? 
All the articles I read about shared pointers, the way the reference count is shown is always common.  Is the counter a static variable? 

A:

Where exactly the count is stored depends on the implementation.  However, the standard prescribes that it must behave so that all instances of std::shared_ptr<T> which share ownership of one instance of T use the same reference count.  In practice, this means that the reference count is allocated dynamically and a pointer to it is shared by all the relevant instances of std::shared_ptr<T>. 
That's one of the reasons why std::make_shared() is the preferred way of creating shared pointers - it can allocate memory for the reference count (and other maintenance structures required) and for the object in one allocation request, instead of two separate ones.  This improves performance of the allocation and perhaps also of use of the pointer (as the ref.  count and object will be closer in memory and thus make cache misses less likely).