diff options
| -rw-r--r-- | include/ocl/tproc/detail/rope_fwd.hpp | 17 | ||||
| -rw-r--r-- | include/ocl/tproc/detail/rope_fwd.inl | 2 | ||||
| -rw-r--r-- | test/rope_test/crope.pred.test.cpp | 5 | ||||
| -rw-r--r-- | test/rope_test/crope.test.cpp | 2 |
4 files changed, 14 insertions, 12 deletions
diff --git a/include/ocl/tproc/detail/rope_fwd.hpp b/include/ocl/tproc/detail/rope_fwd.hpp index 1691f93..912d889 100644 --- a/include/ocl/tproc/detail/rope_fwd.hpp +++ b/include/ocl/tproc/detail/rope_fwd.hpp @@ -3,8 +3,8 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // Official repository: https://github.com/ocl-org/tproc -#ifndef OCL_TPROC_ROPE_FWD_HPP -#define OCL_TPROC_ROPE_FWD_HPP +#ifndef __OCL_TPROC_ROPE_FWD_HPP +#define __OCL_TPROC_ROPE_FWD_HPP #include <ocl/tproc/detail/config.hpp> @@ -30,17 +30,17 @@ namespace ocl::tproc using pointer = std::allocator_traits<Allocator>::pointer; using const_pointer = std::allocator_traits<Allocator>::pointer; - CharT* begin(); - CharT* end(); + basic_rope<CharT, Traits, Allocator>& begin(); + basic_rope<CharT, Traits, Allocator>& end(); - const CharT* cbegin() const; - const CharT* cend() const; + const basic_rope<CharT, Traits, Allocator>& cbegin() const; + const basic_rope<CharT, Traits, Allocator>& cend() const; /// \brief Extarcts a needle from a position of n length. basic_rope<CharT, Traits, Allocator>& substr(size_type pos, const size_type n = 0); /// \brief Rope's version of the find method. - size_type find(const boost::core::string_view& needle); + size_type at(const boost::core::string_view& needle); size_type size(); bool empty() const; @@ -52,6 +52,9 @@ namespace ocl::tproc basic_rope& operator=(basic_rope&& rope); basic_rope(basic_rope&& rope); + public: + static constexpr size_type npos = (size_type)(-1); + private: struct tree_impl; tree_impl* impl_{}; diff --git a/include/ocl/tproc/detail/rope_fwd.inl b/include/ocl/tproc/detail/rope_fwd.inl index b1c5c4e..1d282bb 100644 --- a/include/ocl/tproc/detail/rope_fwd.inl +++ b/include/ocl/tproc/detail/rope_fwd.inl @@ -49,7 +49,7 @@ namespace ocl::tproc basic_rope<CharT, Traits, Allocator>::basic_rope( basic_rope<CharT, Traits, Allocator>&& other) { - impl_ = std::exchange(other.impl_); + impl_ = std::exchange(other.impl_); } template <class CharT, class Traits, class Allocator> diff --git a/test/rope_test/crope.pred.test.cpp b/test/rope_test/crope.pred.test.cpp index 0bf5fbc..ba43331 100644 --- a/test/rope_test/crope.pred.test.cpp +++ b/test/rope_test/crope.pred.test.cpp @@ -13,8 +13,7 @@ BOOST_AUTO_TEST_CASE(rope_should_succeed_in_empty_pred) { auto rope = ocl::tproc::crope(""); - auto it = ocl::tproc::rope::find(rope.cbegin(), rope.cend(), ocl::tproc::rope::exact_pred("foo")); - + auto it = ocl::tproc::rope::find(rope.cbegin(), rope.cend(), ocl::tproc::rope::exact_pred("foo")); BOOST_TEST(it == rope.cend()); } @@ -22,7 +21,7 @@ BOOST_AUTO_TEST_CASE(rope_should_not_succeed_in_empty_pred) { auto rope = ocl::tproc::crope("foobar"); + // find the leaf with the exact value 'foo' auto it = ocl::tproc::rope::find(rope.cbegin(), rope.cend(), ocl::tproc::rope::starts_with_pred("foo")); - BOOST_TEST(it != rope.cend()); } diff --git a/test/rope_test/crope.test.cpp b/test/rope_test/crope.test.cpp index 9b9b9eb..8c2b302 100644 --- a/test/rope_test/crope.test.cpp +++ b/test/rope_test/crope.test.cpp @@ -13,7 +13,7 @@ BOOST_AUTO_TEST_CASE(allocator_should_succeed_in_empty) { auto rope = ocl::tproc::crope(""); - + BOOST_TEST(rope.empty() == true); } |
