Skip to content

src: Modernized unique_ptr construction

Rodrigo Muino Tomonari requested to merge github/fork/Yuhanun/patch-1 into master
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows [commit guidelines]

A simple first contribution.

std::unique_ptr's constructor can lead to memory leaks if the constructed value, allocated through new, throws an exception or something that causes an immediate backtrace on the callstack.

std::make_unique prevents this by allocating the memory for you, making it safer. Not only does it make it safer, it also makes it more readable.

I'm not sure whether I followed every guideline with this, but I hope I did.

Merge request reports

Loading