diff --git a/include/Arabica/StringAdaptor.hpp b/include/Arabica/StringAdaptor.hpp index ea90ec23..75cac5a4 100644 --- a/include/Arabica/StringAdaptor.hpp +++ b/include/Arabica/StringAdaptor.hpp @@ -57,6 +57,8 @@ public: static bool empty(const string_type& str) { return str.empty(); } static size_type find(const string_type& str, value_type what) { return str.find(what); } static size_type find(const string_type& str, const string_type& what) { return str.find(what); } + static size_type find(const string_type& str, value_type what, size_type from) { return str.find(what, from); } + static size_type find(const string_type& str, const string_type& what, size_type from) { return str.find(what, from); } static string_type substr(const string_type& str, const size_type& offset) { return str.substr(offset); } static string_type substr(const string_type& str, const size_type& offset, const size_type& count) { return str.substr(offset, count); } static void append(string_type& str, const string_type& a) { str.append(a); } diff --git a/tests/silly_string/silly_string.cpp b/tests/silly_string/silly_string.cpp index 932e508b..90a8ae8c 100644 --- a/tests/silly_string/silly_string.cpp +++ b/tests/silly_string/silly_string.cpp @@ -95,6 +95,16 @@ silly_string_adaptor::size_type silly_string_adaptor::find(const silly_string& s return str.s_.find(c); } // find +silly_string_adaptor::size_type silly_string_adaptor::find(const silly_string& str, const silly_string& what, silly_string_adaptor::size_type from) +{ + return str.s_.find(what.s_, from); +} // find + +silly_string_adaptor::size_type silly_string_adaptor::find(const silly_string& str, value_type c, silly_string_adaptor::size_type from) +{ + return str.s_.find(c, from); +} // find + silly_string silly_string_adaptor::substr(const silly_string& str, const size_type& offset) { return silly_string_adaptor::construct_from_utf8(str.s_.substr(offset).c_str()); diff --git a/tests/silly_string/silly_string.hpp b/tests/silly_string/silly_string.hpp index 93d12dd2..3f0eacf8 100644 --- a/tests/silly_string/silly_string.hpp +++ b/tests/silly_string/silly_string.hpp @@ -72,6 +72,8 @@ public: static bool empty(const silly_string& s); static size_type find(const silly_string& str, const silly_string& what); static size_type find(const silly_string& str, value_type c); + static size_type find(const silly_string& str, const silly_string& what, size_type from); + static size_type find(const silly_string& str, value_type c, size_type from); static silly_string substr(const silly_string& str, const size_type& offset); static silly_string substr(const silly_string& str, const size_type& offset, const size_type& count); static size_type length(const silly_string& str); @@ -101,12 +103,15 @@ namespace std { template<> struct less : public binary_function -{ // functor for operator< - bool operator()(const silly_string& lhs, const silly_string& rhs) const - { // apply operator< to operands +{ + // functor for operator< + bool operator()(const silly_string& lhs, const silly_string& rhs) const + { + // apply operator< to operands return (silly_string_adaptor::asStdString(lhs) < silly_string_adaptor::asStdString(rhs)); - } + } // operator() }; + } // namespace std #endif