Generic object pool class I have decided to make small ObjectPool class for internal use. What do you think about it ?

template&lt;class T&gt;
class ObjectPool
{
public:
    inline T&amp; getObject();
    inline void releaseObject(T&amp; obj);
private:
    std::stack&lt;std::reference_wrapper&lt;T&gt;&gt; mFree;
    std::vector&lt;T&gt; mPool;
};

template&lt;class T&gt;
void ObjectPool&lt;T&gt;::releaseObject(T&amp; obj)
{ 
    mFree.push(obj);
}

template&lt;class T&gt;
T&amp; ObjectPool&lt;T&gt;::getObject()
{
    if (mFree.size()) {
        T&amp; num = mFree.top();
        mFree.pop();
        return num;
    } else {  
        mPool.emplace_back();
        return mPool.back();
    }
}


I also want to make all function and data static. Is that considered a bad practice?
First of all, free references will be invalidated each time mPool resizes. Which will lead to all sorts of undefined behavior.

Resizing pool is not a great idea in terms of performance, too. Better have constant size chunks, and add more chunks if needed.

Such a pool implies your user is no more able to get benefits of RAII, which can be a huge loss. 

For your question about static methods. It is not a bad practice per se, but your user will no longer be allowed to use different pools for the same type. If you want to make a static method, you better have strong argument to do so.

Overall, consider to use containers+allocators instead of pool.