Created on 2019-05-07.00:00:00 last changed 12 months ago
Proposed resolution:
This wording is relative to N4917 and assumes the acceptance of P2696R0.
Modify [re.submatch], class template sub_match synopsis, as indicated:
template<class BidirectionalIterator> class sub_match : public pair<BidirectionalIterator, BidirectionalIterator> { public: […] int compare(const sub_match& s) const; int compare(const string_type& s) const; int compare(const value_type* s) const; void swap(sub_match& s) noexcept(see below); };
Modify [re.submatch.members] as indicated:
int compare(const value_type* s) const;[…]
void swap(sub_match& s) noexcept(see below);[Drafting note: The Cpp17Swappable requirement should really be unnecessary because Cpp17Iterator requires it, but there is no wording that requires BidirectionalIterator in Clause [re] in general meets the bidirectional iterator requirements. Note that the definition found in [algorithms.requirements] does not extend to [re] normatively. — end drafting note]-?- Preconditions: BidirectionalIterator meets the Cpp17Swappable requirements ([swappable.requirements]).
-?- Effects: Equivalent to:this->pair<BidirectionalIterator, BidirectionalIterator>::swap(s); std::swap(matched, s.matched);-?- Remarks: The exception specification is equivalent to is_nothrow_swappable_v<BidirectionalIterator>.
[ 2023-02-13 Approved at February 2023 meeting in Issaquah. Status changed: Voting → WP. ]
[ 2022-11-30; Reflector poll ]
Set status to Tentatively Ready after six votes in favour during reflector poll.
[ 2022-11-06; Daniel comments and improves wording ]
With the informal acceptance of P2696R0 by LWG during a pre-Kona telecon, we should use the new requirement set Cpp17Swappable instead of the "LValues are swappable" requirements.
[ 2022-04-25; Daniel adjusts wording to recent working draft ]
In addition the revised wording uses the new standard phrase "The exception specification is equivalent to"
Previous resolution [SUPERSEDED]:
This wording is relative to N4910.
Modify [re.submatch], class template sub_match synopsis, as indicated:
template<class BidirectionalIterator> class sub_match : public pair<BidirectionalIterator, BidirectionalIterator> { public: […] int compare(const sub_match& s) const; int compare(const string_type& s) const; int compare(const value_type* s) const; void swap(sub_match& s) noexcept(see below); };Modify [re.submatch.members] as indicated:
int compare(const value_type* s) const;[…]
void swap(sub_match& s) noexcept(see below);[Drafting note: The swappable requirement should really be unnecessary because Cpp17Iterator requires it, but there is no wording that requires BidirectionalIterator in Clause [re] in general meets the bidirectional iterator requirements. Note that the definition found in [algorithms.requirements] does not extend to [re] normatively. — end drafting note]-?- Preconditions: Lvalues of type BidirectionalIterator are swappable ([swappable.requirements]).
-?- Effects: Equivalent to:this->pair<BidirectionalIterator, BidirectionalIterator>::swap(s); std::swap(matched, s.matched);-?- Remarks: The exception specification is equivalent to is_nothrow_swappable_v<BidirectionalIterator>.
[ 2020-05-01; Daniel adjusts wording to recent working draft ]
[ 2019-06-12 Priority set to 3 after reflector discussion ]
sub_match<I> derives publicly from pair<I,I>, and so inherits pair::swap(pair&). This means that the following program fails:
#include <regex> #include <cassert> int main() { std::sub_match<const char*> a, b; a.matched = true; a.swap(b); assert(b.matched); }
The pair::swap(pair&) member should be hidden by a sub_match::swap(sub_match&) member that does the right thing.
History | |||
---|---|---|---|
Date | User | Action | Args |
2023-11-22 15:47:43 | admin | set | status: wp -> c++23 |
2023-02-13 10:17:57 | admin | set | messages: + msg13350 |
2023-02-13 10:17:57 | admin | set | status: voting -> wp |
2023-02-06 15:33:48 | admin | set | status: ready -> voting |
2022-11-30 09:50:57 | admin | set | messages: + msg13123 |
2022-11-30 09:50:57 | admin | set | status: new -> ready |
2022-11-06 12:07:45 | admin | set | messages: + msg12937 |
2022-04-25 12:14:13 | admin | set | messages: + msg12433 |
2020-05-01 18:40:29 | admin | set | messages: + msg11248 |
2019-06-10 05:16:56 | admin | set | messages: + msg10434 |
2019-05-11 13:27:56 | admin | set | messages: + msg10403 |
2019-05-07 00:00:00 | admin | create |