← Back to team overview

kicad-developers team mailing list archive

Re: [PATCH] C++14-style std::make_unique for C++11

 

After reading about the application of std::make_unique, I like it; I am
not opposed to merging this. I would, however, be in favor of modifying
it slightly to emit a warning or error if built under C++14, so that it
is not forgotten if and when we do make the transition to C++14 in the
future.

Is anybody else for or against this?

On Sun, Jan 22, 2017 at 12:38:07AM +0800, John Beard wrote:
> Hi,
> 
> This is a patch to add std::make_unique to common.h when the C++
> standard is C++11 (which it normally is for KiCad).
> 
> This simplifies code creating std::unique_ptr's and also means you can
> generally say "never use new". It also closes a potential for
> exception-unsafety concerning temporary "new"ed objects.
> 
> It's cribbed shamelessly from its proposal for C++14
> (https://isocpp.org/files/papers/N3656.txt), and that's more or less
> exactly how my GCC (6.3.1) implements it too. I've added the GCC
> comments in for good measure.
> 
> The idea here is that when KiCad one day moves on to C++14, this file
> can be removed entirely and forgetten!
> 
> Cheers,
> 
> John



Follow ups

References