summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--include/ocl/tproc/detail/rope_fwd.hpp2
-rw-r--r--include/ocl/tproc/detail/rope_fwd.inl30
2 files changed, 28 insertions, 4 deletions
diff --git a/include/ocl/tproc/detail/rope_fwd.hpp b/include/ocl/tproc/detail/rope_fwd.hpp
index 0aabf86..577cbb1 100644
--- a/include/ocl/tproc/detail/rope_fwd.hpp
+++ b/include/ocl/tproc/detail/rope_fwd.hpp
@@ -39,6 +39,8 @@ namespace ocl::tproc
rope_ptr end();
pointer operator*() const;
+ rope_ptr operator--();
+ rope_ptr operator--(int);
rope_ptr operator++();
rope_ptr operator++(int);
diff --git a/include/ocl/tproc/detail/rope_fwd.inl b/include/ocl/tproc/detail/rope_fwd.inl
index dfe4b1f..fededbc 100644
--- a/include/ocl/tproc/detail/rope_fwd.inl
+++ b/include/ocl/tproc/detail/rope_fwd.inl
@@ -29,10 +29,11 @@ namespace ocl::tproc
size_type weight_{0}; // Size of left subtree (internal) OR data size (leaf)
value_type* blob_{nullptr}; // Character data (leaf node only)
allocator_type alloc_;
- size_type capacity_{0}; // Allocated blob capacity
+ size_type capacity_{0}; // Allocated blob capacity
public:
- tree_impl(Allocator alloc = Allocator()) : alloc_(alloc)
+ tree_impl(Allocator alloc = Allocator())
+ : alloc_(alloc)
{
}
@@ -42,7 +43,8 @@ namespace ocl::tproc
}
tree_impl(const boost::core::basic_string_view<CharT>& str,
- Allocator alloc = Allocator()) : weight_(str.size()), alloc_(alloc), capacity_(str.size())
+ Allocator alloc = Allocator())
+ : weight_(str.size()), alloc_(alloc), capacity_(str.size())
{
if (weight_ > 0)
{
@@ -58,7 +60,8 @@ namespace ocl::tproc
tree_impl(rope_ptr left,
rope_ptr right,
- Allocator alloc = Allocator()) : left_(left), right_(right), alloc_(alloc)
+ Allocator alloc = Allocator())
+ : left_(left), right_(right), alloc_(alloc)
{
weight_ = left ? left->impl_->total_size() : 0;
}
@@ -623,6 +626,25 @@ namespace ocl::tproc
return ret;
}
+ template <class CharT, class Traits, class Allocator>
+ basic_rope<CharT, Traits, Allocator>::rope_ptr basic_rope<CharT, Traits, Allocator>::operator--()
+ {
+ return impl_->left_;
+ }
+
+ template <class CharT, class Traits, class Allocator>
+ basic_rope<CharT, Traits, Allocator>::rope_ptr basic_rope<CharT, Traits, Allocator>::operator--(int n)
+ {
+ rope_ptr ret{};
+ while (n)
+ {
+ ret = this->operator--();
+ --n;
+ }
+
+ return ret;
+ }
+
} // namespace ocl::tproc
#endif