class TsDatabasePool
{
private:
TsDatabasePool(int numDBConn, std::string& DBName, std::string& DBType);
static TsDatabasePool* objInst_;
public:
~TsDatabasePool();
QSqlDatabase* borrowFromPool();
void returnToPool(QSqlDatabase*);
static bool createInstance(std::string& DBName, std::string& DBType);
static TsDatabasePool* getInstance();
};
My destructor is not called implicitly. Object instance used objInst_ is allocated in private constructor. I dont want to call destructor or call delete objInst_ inside any existing function. Can anyone tell me what should i do
I believe what you are trying to do here is destroy a singleton object.
It can be done as follows in a Singlethreaded Enviornment:
Ideally, You can use something like shared_ptr to ensure that the object stays around until no-one needs it any more.