You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This addresses issue #68 by adding a constraint to std::unique_ptr. The move constructors are disabled if the unique_ptr's deleter is not moveable.
The noexcept() specifiers and constraint on the move constructor and assignment operator for std::tuple are already implemented and work correctly.
I understand README.md. I also understand that acceptance of
community PRs will be delayed until the test and CI systems are online.
If this is a feature addition, that feature has been voted into the
C++ Working Draft.
The STL builds successfully and all tests have passed (must be manually
verified by an STL maintainer before CI is online, leave this unchecked for
initial submission).
These changes introduce no known ABI breaks (adding members, renaming
members, adding virtual functions, changing whether a type is an aggregate
or trivially copyable, etc.).
These changes were written from scratch using only this repository and
the C++ Working Draft as a reference (and any other cited standards).
If they were derived from a project that's already listed in NOTICE.txt,
that's fine, but please mention it. If they were derived from any other
project (including Boost and libc++, which are not yet listed in
NOTICE.txt), you must mention it here, so we can determine whether the
license is compatible and what else needs to be done.
The following code is what I used to test std::tuple's noexcept() specifier, the constraints on its move constructor/assignment operators, and the newly added constraints on std::unique_ptr's move constructor/assignment operator.
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I'd be concerned about the lack of positive test coverage (i.e., that unique_ptr is move-meowable when the deleter is_move_meowable_v) were this a new library component, but I know we have enough actual usage of unique_ptr around the test suite to cover it.
I'll approve contingent on this being applied internally with the test bits before it's merged here.
Casey Carter (@CaseyCarter) can you explain why we don't need unique_ptr& operator=(const volatile unique_ptr&) = delete; like tuple has? When the constraints SFINAE away, why doesn't the language/compiler attempt to generate copies/moves?
Thanks Stephan T. Lavavej (@StephanTLavavej) for catching the constructible to assignable for the move operators. I also went ahead and changed _MyDx to _Dx2 to match the previous style on other SFINAE enable_it_t's
Casey Carter (@CaseyCarter) can you explain why we don't need unique_ptr& operator=(const volatile unique_ptr&) = delete; like tuple has? When the constraints SFINAE away, why doesn't the language/compiler attempt to generate copies/moves?
I was confused as well. We were already explicitly deleting unique_ptr's copy constructor and assignment operator - which is unconventional, we'd typically define moves and let the copies be implicitly deleted - and the definitions are in an unconventional place as well at the bottom of the public section of the class bodies after reset. I don't think past us intentionally tried to trick current us, but had we wanted to do so I don't think we could have devised a better way to do it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Description
This addresses issue #68 by adding a constraint to
std::unique_ptr. The move constructors are disabled if theunique_ptr's deleter is not moveable.The
noexcept()specifiers and constraint on the move constructor and assignment operator forstd::tupleare already implemented and work correctly.community PRs will be delayed until the test and CI systems are online.
C++ Working Draft.
_Uglyas perhttps://eel.is/c++draft/lex.name#3.1 .
verified by an STL maintainer before CI is online, leave this unchecked for
initial submission).
members, adding virtual functions, changing whether a type is an aggregate
or trivially copyable, etc.).
the C++ Working Draft as a reference (and any other cited standards).
If they were derived from a project that's already listed in NOTICE.txt,
that's fine, but please mention it. If they were derived from any other
project (including Boost and libc++, which are not yet listed in
NOTICE.txt), you must mention it here, so we can determine whether the
license is compatible and what else needs to be done.