I am talking about general application’s, not low-level such that they are interfacing with hardware.
Looking at legacy code there is lots of:
delete myObject;
Why was the concept of Smart Pointer’s not introduced much earlier, it just makes use of RAII, a concept where stack based object’s destruct on leaving scope. This has been there since day one.
Could it be performance, one extra level of direction (but this is small price/overhead to pay).
A developer can create a basic but functional custom Smart Pointer in less than 30 minutes. So why so long?
Or was it there, but people chose not to make use of it…
I don’t know the answer, but as C++ evolved from C, a lot of code in C used malloc/free as there was no other way to do it and so it carried over to C++ as new/delete. I’m sure the smart pointer implementation in C++ occurred after the language was created, after all, it needs templates which didn’t exist in early versions of C++.