← Back to team overview

kicad-developers team mailing list archive

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

 

I'm not opposed but I agree with your assessment that it needs to not
build when c++14 is defined.  Is this something that devs are going to
use or is something we can push off until we are actually a c++14 project?

On 1/22/2017 10:51 AM, Chris Pavlina wrote:
> 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
> 
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
> 



References