From 884bf048d4a9a37d430cb6ddc43d168d089ed876 Mon Sep 17 00:00:00 2001 From: bolero-MURAKAMI Date: Mon, 8 Oct 2012 23:49:05 +0900 Subject: [PATCH] add sprout::npos --- libs/string/test/string.cpp | 42 ++++----- sprout/string.hpp | 1 + sprout/string/npos.hpp | 16 ++++ sprout/string/string.hpp | 176 +++++++++++++++++++++--------------- 4 files changed, 140 insertions(+), 95 deletions(-) create mode 100644 sprout/string/npos.hpp diff --git a/libs/string/test/string.cpp b/libs/string/test/string.cpp index 52cda3df..1de8be36 100644 --- a/libs/string/test/string.cpp +++ b/libs/string/test/string.cpp @@ -132,57 +132,57 @@ namespace testspr { } // find - TESTSPR_BOTH_ASSERT(str1.find(str2) == decltype(str1)::npos); + TESTSPR_BOTH_ASSERT(str1.find(str2) == npos); TESTSPR_BOTH_ASSERT(str1.find(to_string("bar")) == 3); - TESTSPR_BOTH_ASSERT(str1.find(str2.c_str()) == decltype(str1)::npos); + TESTSPR_BOTH_ASSERT(str1.find(str2.c_str()) == npos); TESTSPR_BOTH_ASSERT(str1.find("bar") == 3); - TESTSPR_BOTH_ASSERT(str1.find(str2.c_str(), 0, 3) == decltype(str1)::npos); + TESTSPR_BOTH_ASSERT(str1.find(str2.c_str(), 0, 3) == npos); TESTSPR_BOTH_ASSERT(str1.find("barbar", 0, 3) == 3); TESTSPR_BOTH_ASSERT(str1.find('b') == 3); // rfind - TESTSPR_BOTH_ASSERT(str1.rfind(str2) == decltype(str1)::npos); + TESTSPR_BOTH_ASSERT(str1.rfind(str2) == npos); TESTSPR_BOTH_ASSERT(str1.rfind(to_string("bar")) == 3); - TESTSPR_BOTH_ASSERT(str1.rfind(str2.c_str()) == decltype(str1)::npos); + TESTSPR_BOTH_ASSERT(str1.rfind(str2.c_str()) == npos); TESTSPR_BOTH_ASSERT(str1.rfind("bar") == 3); - TESTSPR_BOTH_ASSERT(str1.rfind(str2.c_str(), decltype(str1)::npos, 3) == decltype(str1)::npos); - TESTSPR_BOTH_ASSERT(str1.rfind("barbar", decltype(str1)::npos, 3) == 3); + TESTSPR_BOTH_ASSERT(str1.rfind(str2.c_str(), npos, 3) == npos); + TESTSPR_BOTH_ASSERT(str1.rfind("barbar", npos, 3) == 3); TESTSPR_BOTH_ASSERT(str1.rfind('b') == 3); // find_first_of - TESTSPR_BOTH_ASSERT(str1.find_first_of(to_string("vwxyz")) == decltype(str1)::npos); + TESTSPR_BOTH_ASSERT(str1.find_first_of(to_string("vwxyz")) == npos); TESTSPR_BOTH_ASSERT(str1.find_first_of(to_string("rab")) == 3); - TESTSPR_BOTH_ASSERT(str1.find_first_of("vwxyz") == decltype(str1)::npos); + TESTSPR_BOTH_ASSERT(str1.find_first_of("vwxyz") == npos); TESTSPR_BOTH_ASSERT(str1.find_first_of("rab") == 3); - TESTSPR_BOTH_ASSERT(str1.find_first_of("vwxyz", 0, 3) == decltype(str1)::npos); + TESTSPR_BOTH_ASSERT(str1.find_first_of("vwxyz", 0, 3) == npos); TESTSPR_BOTH_ASSERT(str1.find_first_of("rabrab", 0, 3) == 3); TESTSPR_BOTH_ASSERT(str1.find_first_of('b') == 3); // find_last_of - TESTSPR_BOTH_ASSERT(str1.find_last_of(to_string("vwxyz")) == decltype(str1)::npos); + TESTSPR_BOTH_ASSERT(str1.find_last_of(to_string("vwxyz")) == npos); TESTSPR_BOTH_ASSERT(str1.find_last_of(to_string("rab")) == 5); - TESTSPR_BOTH_ASSERT(str1.find_last_of("vwxyz") == decltype(str1)::npos); + TESTSPR_BOTH_ASSERT(str1.find_last_of("vwxyz") == npos); TESTSPR_BOTH_ASSERT(str1.find_last_of("rab") == 5); - TESTSPR_BOTH_ASSERT(str1.find_last_of("vwxyz", decltype(str1)::npos, 3) == decltype(str1)::npos); - TESTSPR_BOTH_ASSERT(str1.find_last_of("rabrab", decltype(str1)::npos, 3) == 5); + TESTSPR_BOTH_ASSERT(str1.find_last_of("vwxyz", npos, 3) == npos); + TESTSPR_BOTH_ASSERT(str1.find_last_of("rabrab", npos, 3) == 5); TESTSPR_BOTH_ASSERT(str1.find_last_of('r') == 5); // find_first_not_of - TESTSPR_BOTH_ASSERT(str1.find_first_not_of(str1) == decltype(str1)::npos); + TESTSPR_BOTH_ASSERT(str1.find_first_not_of(str1) == npos); TESTSPR_BOTH_ASSERT(str1.find_first_not_of(to_string("foo")) == 3); - TESTSPR_BOTH_ASSERT(str1.find_first_not_of(str1.c_str()) == decltype(str1)::npos); + TESTSPR_BOTH_ASSERT(str1.find_first_not_of(str1.c_str()) == npos); TESTSPR_BOTH_ASSERT(str1.find_first_not_of("foo") == 3); - TESTSPR_BOTH_ASSERT(str1.find_first_not_of(str1.c_str(), 0, 10) == decltype(str1)::npos); + TESTSPR_BOTH_ASSERT(str1.find_first_not_of(str1.c_str(), 0, 10) == npos); TESTSPR_BOTH_ASSERT(str1.find_first_not_of("foofoo", 0, 3) == 3); TESTSPR_BOTH_ASSERT(str1.find_first_not_of('f') == 1); // find_last_not_of - TESTSPR_BOTH_ASSERT(str1.find_last_not_of(str1) == decltype(str1)::npos); + TESTSPR_BOTH_ASSERT(str1.find_last_not_of(str1) == npos); TESTSPR_BOTH_ASSERT(str1.find_last_not_of(to_string("4321")) == 5); - TESTSPR_BOTH_ASSERT(str1.find_last_not_of(str1.c_str()) == decltype(str1)::npos); + TESTSPR_BOTH_ASSERT(str1.find_last_not_of(str1.c_str()) == npos); TESTSPR_BOTH_ASSERT(str1.find_last_not_of("4321") == 5); - TESTSPR_BOTH_ASSERT(str1.find_last_not_of(str1.c_str(), decltype(str1)::npos, 10) == decltype(str1)::npos); - TESTSPR_BOTH_ASSERT(str1.find_last_not_of("43214321", decltype(str1)::npos, 4) == 5); + TESTSPR_BOTH_ASSERT(str1.find_last_not_of(str1.c_str(), npos, 10) == npos); + TESTSPR_BOTH_ASSERT(str1.find_last_not_of("43214321", npos, 4) == 5); TESTSPR_BOTH_ASSERT(str1.find_last_not_of('4') == 8); // substr diff --git a/sprout/string.hpp b/sprout/string.hpp index 37c60bae..6a9eb4f1 100644 --- a/sprout/string.hpp +++ b/sprout/string.hpp @@ -2,6 +2,7 @@ #define SPROUT_STRING_HPP #include +#include #include #include #include diff --git a/sprout/string/npos.hpp b/sprout/string/npos.hpp new file mode 100644 index 00000000..1761dffc --- /dev/null +++ b/sprout/string/npos.hpp @@ -0,0 +1,16 @@ +#ifndef SPROUT_STRING_NPOS_HPP +#define SPROUT_STRING_NPOS_HPP + +#include +#include + +namespace sprout { + // + // npos + // + namespace { + SPROUT_STATIC_CONSTEXPR std::size_t npos = -1; + } // anonymous-namespace +} // namespace sprout + +#endif // #ifndef SPROUT_STRING_NPOS_HPP diff --git a/sprout/string/string.hpp b/sprout/string/string.hpp index d854b429..a9d66ea9 100644 --- a/sprout/string/string.hpp +++ b/sprout/string/string.hpp @@ -13,6 +13,7 @@ #include #include #include +#include #include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT #include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT #if SPROUT_USE_INDEX_ITERATOR_IMPLEMENTATION @@ -44,25 +45,52 @@ namespace sprout { typedef sprout::reverse_iterator const_reverse_iterator; typedef Traits traits_type; typedef sprout::char_traits_helper traits_helper_type; +#if SPROUT_USE_INDEX_ITERATOR_IMPLEMENTATION + private: + template + class is_string_iterator + : public std::false_type + {}; + template + class is_string_iterator + : public is_string_iterator + {}; + template + class is_string_iterator + : public is_string_iterator + {}; + template + class is_string_iterator + : public is_string_iterator + {}; + template + class is_string_iterator&> > + : public std::true_type + {}; + template + class is_string_iterator const&> > + : public std::true_type + {}; +#endif public: - SPROUT_STATIC_CONSTEXPR size_type npos = -1; + SPROUT_STATIC_CONSTEXPR size_type npos = sprout::npos; SPROUT_STATIC_CONSTEXPR size_type static_size = N; private: template static SPROUT_CONSTEXPR size_type - find_impl_2(const_iterator data, size_type len, ConstIterator s, size_type pos, size_type n) { + find_impl_1(const_iterator data, size_type len, ConstIterator s, size_type pos, size_type n) { return pos <= len - n ? traits_type::eq(data[pos], *s) && traits_type::compare(data + (pos + 1), s + 1, n - 1) == 0 ? pos - : find_impl_2(data, len, s, pos + 1, n) + : find_impl_1(data, len, s, pos + 1, n) : npos ; } template static SPROUT_CONSTEXPR size_type - find_impl_1(const_iterator data, size_type len, ConstIterator s, size_type pos, size_type n) { + find_impl(const_iterator data, size_type len, ConstIterator s, size_type pos, size_type n) { return n == 0 ? (pos <= len ? pos : npos) - : n <= len ? find_impl_2(data, len, s, pos, n) + : n <= len ? find_impl_1(data, len, s, pos, n) : npos ; } @@ -74,16 +102,16 @@ namespace sprout { } template static SPROUT_CONSTEXPR size_type - rfind_impl_2(const_iterator data, size_type len, ConstIterator s, size_type pos, size_type n) { + rfind_impl_1(const_iterator data, size_type len, ConstIterator s, size_type pos, size_type n) { return traits_type::compare(data + pos, s, n) == 0 ? pos - : pos > 0 ? rfind_impl_2(data, len, s, pos - 1, n) + : pos > 0 ? rfind_impl_1(data, len, s, pos - 1, n) : npos ; } template static SPROUT_CONSTEXPR size_type - rfind_impl_1(const_iterator data, size_type len, ConstIterator s, size_type pos, size_type n) { - return n <= len ? rfind_impl_2(data, len, s, NS_SSCRISK_CEL_OR_SPROUT::min(size_type(len - n), pos), n) + rfind_impl(const_iterator data, size_type len, ConstIterator s, size_type pos, size_type n) { + return n <= len ? rfind_impl_1(data, len, s, NS_SSCRISK_CEL_OR_SPROUT::min(size_type(len - n), pos), n) : npos ; } @@ -98,51 +126,51 @@ namespace sprout { } template static SPROUT_CONSTEXPR size_type - find_first_of_impl_1(const_iterator data, size_type len, ConstIterator s, size_type pos, size_type n) { + find_first_of_impl(const_iterator data, size_type len, ConstIterator s, size_type pos, size_type n) { return n && pos < len ? traits_helper_type::is_found(traits_helper_type::find(s, n, data[pos]), s + n) ? pos - : find_first_of_impl_1(data, len, s, pos + 1, n) - : npos - ; - } - template - static SPROUT_CONSTEXPR size_type - find_last_of_impl_2(const_iterator data, size_type len, ConstIterator s, size_type pos, size_type n) { - return traits_helper_type::is_found(traits_helper_type::find(s, n, data[len]), s + n) ? len - : len ? find_last_of_impl_2(data, len - 1, s, pos, n) + : find_first_of_impl(data, len, s, pos + 1, n) : npos ; } template static SPROUT_CONSTEXPR size_type find_last_of_impl_1(const_iterator data, size_type len, ConstIterator s, size_type pos, size_type n) { - return len && n ? find_last_of_impl_2(data, len - 1 > pos ? pos : len - 1, s, pos, n) + return traits_helper_type::is_found(traits_helper_type::find(s, n, data[len]), s + n) ? len + : len ? find_last_of_impl_1(data, len - 1, s, pos, n) : npos ; } template static SPROUT_CONSTEXPR size_type - find_first_not_of_impl_1(const_iterator data, size_type len, ConstIterator s, size_type pos, size_type n) { + find_last_of_impl(const_iterator data, size_type len, ConstIterator s, size_type pos, size_type n) { + return len && n ? find_last_of_impl_1(data, len - 1 > pos ? pos : len - 1, s, pos, n) + : npos + ; + } + template + static SPROUT_CONSTEXPR size_type + find_first_not_of_impl(const_iterator data, size_type len, ConstIterator s, size_type pos, size_type n) { return pos < len ? !traits_helper_type::is_found(traits_helper_type::find(s, n, data[pos]), s + n) ? pos - : find_first_not_of_impl_1(data, len, s, pos + 1, n) - : npos - ; - } - template - static SPROUT_CONSTEXPR size_type - find_last_not_of_impl_2(const_iterator data, size_type len, ConstIterator s, size_type pos, size_type n) { - return !traits_helper_type::is_found(traits_helper_type::find(s, n, data[len]), s + n) ? len - : len ? find_last_not_of_impl_2(data, len - 1, s, pos, n) + : find_first_not_of_impl(data, len, s, pos + 1, n) : npos ; } template static SPROUT_CONSTEXPR size_type find_last_not_of_impl_1(const_iterator data, size_type len, ConstIterator s, size_type pos, size_type n) { - return len ? find_last_not_of_impl_2(data, len - 1 > pos ? pos : len - 1, s, pos, n) + return !traits_helper_type::is_found(traits_helper_type::find(s, n, data[len]), s + n) ? len + : len ? find_last_not_of_impl_1(data, len - 1, s, pos, n) + : npos + ; + } + template + static SPROUT_CONSTEXPR size_type + find_last_not_of_impl(const_iterator data, size_type len, ConstIterator s, size_type pos, size_type n) { + return len ? find_last_not_of_impl_1(data, len - 1 > pos ? pos : len - 1, s, pos, n) : npos ; } @@ -154,7 +182,7 @@ namespace sprout { ; } static SPROUT_CONSTEXPR int - compare_impl_2(int compared, size_type n1, size_type n2) { + compare_impl_1(int compared, size_type n1, size_type n2) { return compared != 0 ? compared : n1 < n2 ? -1 : n2 < n1 ? 1 @@ -163,8 +191,8 @@ namespace sprout { } template static SPROUT_CONSTEXPR int - compare_impl_1(const_iterator dest, size_type pos1, size_type n1, ConstIterator s, size_type n2) { - return compare_impl_2( + compare_impl(const_iterator dest, size_type pos1, size_type n1, ConstIterator s, size_type n2) { + return compare_impl_1( traits_type::compare(dest + pos1, s, NS_SSCRISK_CEL_OR_SPROUT::min(n1, n2)), n1, n2 ); @@ -434,11 +462,11 @@ namespace sprout { template SPROUT_CONSTEXPR size_type find(basic_string const& str, size_type pos = 0) const SPROUT_NOEXCEPT { - return find_impl_1(begin(), len, str.begin(), pos, str.size()); + return find_impl(begin(), len, str.begin(), pos, str.size()); } SPROUT_CONSTEXPR size_type find(value_type const* s, size_type pos, size_type n) const { - return find_impl_1(begin(), len, s, pos, n); + return find_impl(begin(), len, s, pos, n); } SPROUT_CONSTEXPR size_type find(value_type const* s, size_type pos = 0) const { @@ -452,11 +480,11 @@ namespace sprout { } SPROUT_CONSTEXPR size_type rfind(basic_string const& str, size_type pos = npos) const SPROUT_NOEXCEPT { - return rfind_impl_1(begin(), len, str.begin(), pos, str.size()); + return rfind_impl(begin(), len, str.begin(), pos, str.size()); } SPROUT_CONSTEXPR size_type rfind(value_type const* s, size_type pos, size_type n) const { - return rfind_impl_1(begin(), len, s, pos, n); + return rfind_impl(begin(), len, s, pos, n); } SPROUT_CONSTEXPR size_type rfind(value_type const* s, size_type pos = npos) const { @@ -470,11 +498,11 @@ namespace sprout { } SPROUT_CONSTEXPR size_type find_first_of(basic_string const& str, size_type pos = 0) const SPROUT_NOEXCEPT { - return find_first_of_impl_1(begin(), len, str.begin(), pos, str.size()); + return find_first_of_impl(begin(), len, str.begin(), pos, str.size()); } SPROUT_CONSTEXPR size_type find_first_of(value_type const* s, size_type pos, size_type n) const { - return find_first_of_impl_1(begin(), len, s, pos, n); + return find_first_of_impl(begin(), len, s, pos, n); } SPROUT_CONSTEXPR size_type find_first_of(value_type const* s, size_type pos = 0) const { @@ -486,11 +514,11 @@ namespace sprout { } SPROUT_CONSTEXPR size_type find_last_of(basic_string const& str, size_type pos = npos) const SPROUT_NOEXCEPT { - return find_last_of_impl_1(begin(), len, str.begin(), pos, str.size()); + return find_last_of_impl(begin(), len, str.begin(), pos, str.size()); } SPROUT_CONSTEXPR size_type find_last_of(value_type const* s, size_type pos, size_type n) const { - return find_last_of_impl_1(begin(), len, s, pos, n); + return find_last_of_impl(begin(), len, s, pos, n); } SPROUT_CONSTEXPR size_type find_last_of(value_type const* s, size_type pos = npos) const { @@ -502,11 +530,11 @@ namespace sprout { } SPROUT_CONSTEXPR size_type find_first_not_of(basic_string const& str, size_type pos = 0) const SPROUT_NOEXCEPT { - return find_first_not_of_impl_1(begin(), len, str.begin(), pos, str.size()); + return find_first_not_of_impl(begin(), len, str.begin(), pos, str.size()); } SPROUT_CONSTEXPR size_type find_first_not_of(value_type const* s, size_type pos, size_type n) const { - return find_first_not_of_impl_1(begin(), len, s, pos, n); + return find_first_not_of_impl(begin(), len, s, pos, n); } SPROUT_CONSTEXPR size_type find_first_not_of(value_type const* s, size_type pos = 0) const { @@ -523,11 +551,11 @@ namespace sprout { } SPROUT_CONSTEXPR size_type find_last_not_of(basic_string const& str, size_type pos = npos) const SPROUT_NOEXCEPT { - return find_last_not_of_impl_1(begin(), len, str.begin(), pos, str.size()); + return find_last_not_of_impl(begin(), len, str.begin(), pos, str.size()); } SPROUT_CONSTEXPR size_type find_last_not_of(value_type const* s, size_type pos, size_type n) const { - return find_last_not_of_impl_1(begin(), len, s, pos, n); + return find_last_not_of_impl(begin(), len, s, pos, n); } SPROUT_CONSTEXPR size_type find_last_not_of(value_type const* s, size_type pos = npos) const { @@ -577,7 +605,7 @@ namespace sprout { SPROUT_CONSTEXPR int compare(size_type pos1, size_type n1, value_type const* s, size_type n2) const { return !(size() < pos1) - ? compare_impl_1(begin(), pos1, NS_SSCRISK_CEL_OR_SPROUT::min(n1, size() - pos1), s, n2) + ? compare_impl(begin(), pos1, NS_SSCRISK_CEL_OR_SPROUT::min(n1, size() - pos1), s, n2) : throw std::out_of_range("basic_string<>: index out of range") ; } @@ -609,7 +637,7 @@ namespace sprout { #if SPROUT_USE_INDEX_ITERATOR_IMPLEMENTATION template typename std::enable_if< - sprout::is_index_iterator::value, + is_string_iterator::value, basic_string& >::type assign(ConstIterator s, size_type n) { @@ -625,7 +653,7 @@ namespace sprout { } template typename std::enable_if< - sprout::is_index_iterator::value, + is_string_iterator::value, basic_string& >::type assign(ConstIterator s) { @@ -633,7 +661,7 @@ namespace sprout { } template typename std::enable_if< - sprout::is_index_iterator::value, + is_string_iterator::value, basic_string& >::type operator=(ConstIterator rhs) { @@ -642,15 +670,15 @@ namespace sprout { template SPROUT_CONSTEXPR typename std::enable_if< - sprout::is_index_iterator::value, + is_string_iterator::value, size_type >::type find(ConstIterator s, size_type pos, size_type n) const { - return find_impl_1(begin(), len, s, pos, n); + return find_impl(begin(), len, s, pos, n); } template SPROUT_CONSTEXPR typename std::enable_if< - sprout::is_index_iterator::value, + is_string_iterator::value, size_type >::type find(ConstIterator s, size_type pos = 0) const { @@ -658,15 +686,15 @@ namespace sprout { } template SPROUT_CONSTEXPR typename std::enable_if< - sprout::is_index_iterator::value, + is_string_iterator::value, size_type >::type rfind(ConstIterator s, size_type pos, size_type n) const { - return rfind_impl_1(begin(), len, s, pos, n); + return rfind_impl(begin(), len, s, pos, n); } template SPROUT_CONSTEXPR typename std::enable_if< - sprout::is_index_iterator::value, + is_string_iterator::value, size_type >::type rfind(ConstIterator s, size_type pos = npos) const { @@ -674,15 +702,15 @@ namespace sprout { } template SPROUT_CONSTEXPR typename std::enable_if< - sprout::is_index_iterator::value, + is_string_iterator::value, size_type >::type find_first_of(ConstIterator s, size_type pos, size_type n) const { - return find_first_of_impl_1(begin(), len, s, pos, n); + return find_first_of_impl(begin(), len, s, pos, n); } template SPROUT_CONSTEXPR typename std::enable_if< - sprout::is_index_iterator::value, + is_string_iterator::value, size_type >::type find_first_of(ConstIterator s, size_type pos = 0) const { @@ -690,15 +718,15 @@ namespace sprout { } template SPROUT_CONSTEXPR typename std::enable_if< - sprout::is_index_iterator::value, + is_string_iterator::value, size_type >::type find_last_of(ConstIterator s, size_type pos, size_type n) const { - return find_last_of_impl_1(begin(), len, s, pos, n); + return find_last_of_impl(begin(), len, s, pos, n); } template SPROUT_CONSTEXPR typename std::enable_if< - sprout::is_index_iterator::value, + is_string_iterator::value, size_type >::type find_last_of(ConstIterator s, size_type pos = 0) const { @@ -706,39 +734,39 @@ namespace sprout { } template SPROUT_CONSTEXPR typename std::enable_if< - sprout::is_index_iterator::value, + is_string_iterator::value, size_type >::type find_first_not_of(ConstIterator s, size_type pos, size_type n) const { - return find_first_not_of_impl_1(begin(), len, s, pos, n); + return find_first_not_of_impl(begin(), len, s, pos, n); } template SPROUT_CONSTEXPR typename std::enable_if< - sprout::is_index_iterator::value, + is_string_iterator::value, size_type >::type find_first_not_of(ConstIterator s, size_type pos = 0) const { - return find_first_not_of_impl_1(s, pos, traits_type::length(s)); + return find_first_not_of_impl(s, pos, traits_type::length(s)); } template SPROUT_CONSTEXPR typename std::enable_if< - sprout::is_index_iterator::value, + is_string_iterator::value, size_type >::type find_last_not_of(ConstIterator s, size_type pos, size_type n) const { - return find_last_not_of_impl_1(begin(), len, s, pos, n); + return find_last_not_of_impl(begin(), len, s, pos, n); } template SPROUT_CONSTEXPR typename std::enable_if< - sprout::is_index_iterator::value, + is_string_iterator::value, size_type >::type find_last_not_of(ConstIterator s, size_type pos = npos) const { - return find_last_not_of_impl_1(s, pos, traits_type::length(s)); + return find_last_not_of_impl(s, pos, traits_type::length(s)); } template SPROUT_CONSTEXPR typename std::enable_if< - sprout::is_index_iterator::value, + is_string_iterator::value, int >::type compare(ConstIterator s) const { @@ -746,7 +774,7 @@ namespace sprout { } template SPROUT_CONSTEXPR typename std::enable_if< - sprout::is_index_iterator::value, + is_string_iterator::value, int >::type compare(size_type pos1, size_type n1, ConstIterator s) const { @@ -754,12 +782,12 @@ namespace sprout { } template SPROUT_CONSTEXPR typename std::enable_if< - sprout::is_index_iterator::value, + is_string_iterator::value, int >::type compare(size_type pos1, size_type n1, ConstIterator s, size_type n2) const { return !(size() < pos1) - ? compare_impl_1(begin(), pos1, NS_SSCRISK_CEL_OR_SPROUT::min(n1, size() - pos1), s, n2) + ? compare_impl(begin(), pos1, NS_SSCRISK_CEL_OR_SPROUT::min(n1, size() - pos1), s, n2) : throw std::out_of_range("basic_string<>: index out of range") ; }