Y
Hacker News
new
|
ask
|
show
|
jobs
by
zabzonk
1259 days ago
to whoever downvoted this, why would you write 'new MyObject()'?
1 comments
andsoitis
1259 days ago
I didn’t downvote and I don’t know C++, but I thought that the
new
and
delete
operators are how you manage dynamic memory allocation.
Is it not the way?
link
zabzonk
1259 days ago
no, it really isn't. mostly you don't need to manage objects dynamically at all (make them automatic) but if you do, use something like std::make_unique(...)
link
Is it not the way?