C++ Explict Dynamic Memory Allocation - Why?
I don't really understand why one would want to use new in C++. I know what it does, but I don't understand WHY you'd use it. The main purpose I see is in arrays, but honestly, who uses arrays when not handling trivial amount of data? List, deque, vector, map, etc. does all the dynamic memory stuff for us, arguably faster than an array, in some circumstances. The other use, allowing for a permanent variable, I don't see either. I mean, you're going to lose the pointer anyway when the scope ends, unless you return it... so why not just pass-by-value? Can someone clear all of this up for me? Thanks!