Use std::unique_ptr correctly across compiler and language versions #604
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously, the code tried to avoid a
-Wdeprecated-declarations
warning by avoidingstd::auto_ptr
(since #413). However, the implementation has two issues:std::scoped_ptr
, which as far as I can tell is a nonexistent type.std::unique_ptr
is presumably what was meant.auto_ptr
whenver we're using GCC6. This means we don't dodge warnings for GCC5 or clang (which also support C++11). It also means that using GCC6 in C++03 mode fails, becausestd::unique_ptr
doesn't exist there.This fixes both of these issues, using
std::unique_ptr
in C++11 (and MSVC2010) and above.Tested on GCC 5.4.1, GCC 6.2.0 and Clang 5.0.0-svn300863 in both C++03 and C++11 modes.