Le 08/06/2016 21:58, Jean-Marc Lasgouttes a écrit :
Le 08/06/16 à 20:21, Guillaume Munch a écrit :
I'd rather include only the standard headers to obtain unique_ptr, and
then include support/make_unique.h when we explicitly need it.


When you have unique_ptr, you also want to have make_unique without
hassle. The reason is that apart from some corner cases, make_unique is
never really necessary, more of a convenience.

But none of your patches use it, AFAIK.

Yes, RefChanger.h. There's another clean-up patch that uses it that I'm
waiting to commit. And I don't make a big use of unique_ptr in these
patches anyway. Then there are all the substitutions of scoped_ptr and
auto_ptr. But the first thing they do is release the pointer in the
wild, so it was breaking my heart to use make_unique for that (and they
do a cast at the same time so one had to write the full type anyway).


So I prefer to have
unique_ptr.h open unique_ptr in the lyx namespace for me and only have
to include one header. But, you are always free to just include <memory>.

I thought that that the idea was to use C++11 natively instead of our
homegrown headers. So I would put only things that we define ourselves
in support headers. Having one more header to include make it clear of
what we have to do when the feature is natively supported.

Yes, this is the case of a C++14 feature, and we can remove the header once decided to drop support for C++11. BTW the definition is the one recommended by the standard. And it's free, I made it for you.


But then I am not really a C++(11) expert.


Neither am I ;)


Reply via email to