Skip to content

Commit

Permalink
basic_string_view's non-member begin/end should take basic_string_vie…
Browse files Browse the repository at this point in the history
…w by value

... as the working draft requires. Test coverage failed to detect this issue due to an overload resolution bug (https://developercommunity.visualstudio.com/content/problem/739010/overload-resolution-fails-to-select-deleted-overlo.html) in MSVC.

Drive-by: Remove the "accepts rvalues" bit from the comment in `begin` which caused the confusion that gave rise to microsoft#104. Hopefully it is now glaringly obvious that `begin` and `end` accept both lvalues and rvalues.

Resolves microsoft#104.
  • Loading branch information
CaseyCarter committed Sep 19, 2019
1 parent 7f65140 commit e7cd1c5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions stl/inc/xstring
Original file line number Diff line number Diff line change
Expand Up @@ -1205,11 +1205,11 @@ public:
}

#ifdef __cpp_lib_concepts
_NODISCARD friend constexpr const_iterator begin(const basic_string_view& _Right) noexcept {
// non-member overload that accepts rvalues to model the exposition-only forwarding-range concept
_NODISCARD friend constexpr const_iterator begin(basic_string_view _Right) noexcept {
// non-member overload to model the exposition-only forwarding-range concept
return _Right.begin();
}
_NODISCARD friend constexpr const_iterator end(const basic_string_view& _Right) noexcept {
_NODISCARD friend constexpr const_iterator end(basic_string_view _Right) noexcept {
// Ditto modeling forwarding-range
return _Right.end();
}
Expand Down

0 comments on commit e7cd1c5

Please sign in to comment.