Fix <rdar://problem/10255403> match_results::begin() is off by one
llvm-svn: 141494
This commit is contained in:
parent
8a984e9418
commit
2a4812fd04
|
@ -5210,11 +5210,11 @@ public:
|
|||
const_reference suffix() const {return __suffix_;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator begin() const {return empty() ? __matches_.end() : __matches_.begin() + 1;}
|
||||
const_iterator begin() const {return empty() ? __matches_.end() : __matches_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator end() const {return __matches_.end();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator cbegin() const {return empty() ? __matches_.end() : __matches_.begin() + 1;}
|
||||
const_iterator cbegin() const {return empty() ? __matches_.end() : __matches_.begin();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator cend() const {return __matches_.end();}
|
||||
|
||||
|
|
|
@ -27,8 +27,8 @@ test()
|
|||
std::match_results<const char*>::const_iterator i = m.begin();
|
||||
std::match_results<const char*>::const_iterator e = m.end();
|
||||
|
||||
assert(e - i == m.size() - 1);
|
||||
for (int j = 1; i != e; ++i, ++j)
|
||||
assert(e - i == m.size());
|
||||
for (int j = 0; i != e; ++i, ++j)
|
||||
assert(*i == m[j]);
|
||||
}
|
||||
|
||||
|
|
|
@ -27,8 +27,8 @@ test()
|
|||
std::match_results<const char*>::const_iterator i = m.cbegin();
|
||||
std::match_results<const char*>::const_iterator e = m.cend();
|
||||
|
||||
assert(e - i == m.size() - 1);
|
||||
for (int j = 1; i != e; ++i, ++j)
|
||||
assert(e - i == m.size());
|
||||
for (int j = 0; i != e; ++i, ++j)
|
||||
assert(*i == m[j]);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue