How to stop heap memory allocation for class in case of make_shared
Hi Refer code below: https://code.sololearn.com/cUe01sBygcuy Observed that I have overloaded operator new inside class and upon code execution, I am getting custom allocation cout statement once only for raw pointer, that is clsTest* p I dont get custom allocation for make_shared i.e. for sp1. I wanted to make this overloaded new operator private so that we can stop memory allocation on heap for class. but doing so, I am able to allocate memory on heap using make_shared as it is not calling class overloaded new operator. Is there a way to do so? P.S. : If i have class without any operator overloading of new and with new operator overloaded at global level, make_shared and raw pointer both allocates memory from global operator overloaded.