Non-sequential template class container C++
Thanks for a well-presented question!  I'll dive straight in:

Your exceptions are a bit weird.  Leaving aside the impenetrable (to me) naming, I think that adding your own exception types derived directly from std::exception just to add your own what() is probably a poor investment of time.  If you go this way, I certainly recommend that you subclass the provided std::bad_alloc and std::out_of_range, so that existing code that catches those also catches your equivalents.

Having member variables of exception type in your container instances is decidedly unconventional.  We generally create exceptions at the point where they are thrown.  This may be important in a debugging environment, if exceptions there are able to carry context information (as happens in Python and Java, for example).  In production code, the exception construction will be very low overhead compared with actually raising and catching the exception, so there's little to be gained in speed, and something to be lost by adding unnecessary members to every instance.



A quick skim through the rest of the code draws me to this line:

        std::shared_ptr&lt;A_Type&gt; ptr(new A_Type(std::forward&lt;Args&gt;(args)...));


Bare new in modern C++ always triggers my interest - here, it is better to use std::make_shared().  This will give improved memory locality to the object and its smart-pointer control block.



This gives my version of your code as follows:

#include &lt;memory&gt;
#include &lt;vector&gt;

template&lt;typename A_Type&gt;
class CNSContainer
{
    std::vector&lt;std::shared_ptr&lt;A_Type&gt;&gt; pointers_m;
public:
    size_t size()
    {
        return pointers_m.size();
    }

    template &lt;class... Args&gt;
    std::weak_ptr&lt;A_Type&gt; push(Args&amp;&amp;... args)
    {
        // may throw std::bad_alloc - if so, pointers_m is unchanged
        auto ptr = std::make_shared&lt;A_Type&gt;(std::forward&lt;Args&gt;(args)...);
        pointers_m.emplace_back(ptr);
        return ptr;
    }

    void remove(const size_t&amp; key)
    {
        pointers_m.erase(pointers_m.begin() + key);
    }

    // Will throw std::out_of_range if key is invalid
    std::weak_ptr&lt;A_Type&gt; operator[](const size_t&amp; key)
    {
        return pointers_m[key];
    }
};


At this point, there's almost nothing here that's not in the underlying container, and much that's missing (reserve(), iterators, member types, and more).  What you end up with is a convenience function for creating a smart-pointer member in a collection:

#include &lt;memory&gt;

template&lt;typename Container, class... Args&gt;
std::weak_ptr&lt;typename Container::value_type&gt; push(Container&amp; c, Args&amp;&amp;... args)
{
    // may throw std::bad_alloc - if so, c is unchanged
    auto p = std::make_shared&lt;typename Container::value_type&gt;(std::forward&lt;Args&gt;(args)...);
    c.emplace_back(p);
    return p;
}


You might be able to further generalize that to not depend on emplace_back as the insertion method and/or use Concepts to constrain the function and give more informative errors if it's misused.

I'm sorry if the above reduces what you've written to something near-trivial, but I hope you've learnt a lot whilst you were doing it (and that you can apply that to your future projects).  Certainly, you seem to have your head around forwarding references, which is more than many can say!