[cfe-commits] [libcxx] r141494 - in /libcxx/trunk: include/regex test/re/re.results/re.results.acc/begin_end.pass.cpp test/re/re.results/re.results.acc/cbegin_cend.pass.cpp
Howard Hinnant
hhinnant at apple.com
Sat Oct 8 07:36:16 PDT 2011
Author: hhinnant
Date: Sat Oct 8 09:36:16 2011
New Revision: 141494
URL: http://llvm.org/viewvc/llvm-project?rev=141494&view=rev
Log:
Fix <rdar://problem/10255403> match_results::begin() is off by one
Modified:
libcxx/trunk/include/regex
libcxx/trunk/test/re/re.results/re.results.acc/begin_end.pass.cpp
libcxx/trunk/test/re/re.results/re.results.acc/cbegin_cend.pass.cpp
Modified: libcxx/trunk/include/regex
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/regex?rev=141494&r1=141493&r2=141494&view=diff
==============================================================================
--- libcxx/trunk/include/regex (original)
+++ libcxx/trunk/include/regex Sat Oct 8 09:36:16 2011
@@ -5210,11 +5210,11 @@
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();}
Modified: libcxx/trunk/test/re/re.results/re.results.acc/begin_end.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.results/re.results.acc/begin_end.pass.cpp?rev=141494&r1=141493&r2=141494&view=diff
==============================================================================
--- libcxx/trunk/test/re/re.results/re.results.acc/begin_end.pass.cpp (original)
+++ libcxx/trunk/test/re/re.results/re.results.acc/begin_end.pass.cpp Sat Oct 8 09:36:16 2011
@@ -27,8 +27,8 @@
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]);
}
Modified: libcxx/trunk/test/re/re.results/re.results.acc/cbegin_cend.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.results/re.results.acc/cbegin_cend.pass.cpp?rev=141494&r1=141493&r2=141494&view=diff
==============================================================================
--- libcxx/trunk/test/re/re.results/re.results.acc/cbegin_cend.pass.cpp (original)
+++ libcxx/trunk/test/re/re.results/re.results.acc/cbegin_cend.pass.cpp Sat Oct 8 09:36:16 2011
@@ -27,8 +27,8 @@
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]);
}
More information about the cfe-commits
mailing list