From 932101ae44d6fc43e9facff898ed769d1d1099ec Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Fri, 26 Dec 2025 09:30:37 +0100 Subject: feat: API additions and rope_fwd fixes. Signed-off-by: Amlal El Mahrouss --- include/ocl/tproc/detail/rope_fwd.hpp | 2 +- include/ocl/tproc/detail/rope_fwd.inl | 20 +++++++++++++------- include/ocl/tproc/rope.hpp | 12 +++++++++--- 3 files changed, 23 insertions(+), 11 deletions(-) (limited to 'include') diff --git a/include/ocl/tproc/detail/rope_fwd.hpp b/include/ocl/tproc/detail/rope_fwd.hpp index 7a9bca5..f694269 100644 --- a/include/ocl/tproc/detail/rope_fwd.hpp +++ b/include/ocl/tproc/detail/rope_fwd.hpp @@ -11,7 +11,7 @@ /// \file rope_fwd.hpp /// \brief Basic forward definitions of the `rope` type. -namespace ocl +namespace ocl::tproc { /// \brief This class implements a rope type for any **CharT** type. diff --git a/include/ocl/tproc/detail/rope_fwd.inl b/include/ocl/tproc/detail/rope_fwd.inl index 852e065..11ed792 100644 --- a/include/ocl/tproc/detail/rope_fwd.inl +++ b/include/ocl/tproc/detail/rope_fwd.inl @@ -6,12 +6,18 @@ #ifndef OCL_TPROC_ROPE_FWD_INL #define OCL_TPROC_ROPE_FWD_INL -namespace ocl +namespace ocl::tproc { template struct basic_rope::tree_impl { + size_t size_; + CharT* head_, tail_; + + size_t size() { return size_; } + CharT* begin() { return head_; } + CharT* end() { return tail_; } }; template @@ -24,7 +30,7 @@ namespace ocl template basic_rope& basic_rope::operator=( - basic_rope&& rope) + basic_rope&& other) { impl_ = std::exchange(other.impl_); return *this; @@ -32,7 +38,7 @@ namespace ocl template basic_rope::basic_rope( - basic_rope&& rope) + basic_rope&& other) { impl_ = std::exchange(other.impl_); rope.impl_ = nullptr; @@ -48,26 +54,26 @@ namespace ocl template CharT* basic_rope::begin() { - return nullptr; + return impl_->begin(); } template CharT* basic_rope::end() { - return nullptr; + return impl_->end(); } template basic_rope::size_type basic_rope::size() { - return 0UL; + return impl_->size(); } template bool basic_rope::empty() const { - return true; + return impl_->size() < 1; } } // namespace ocl diff --git a/include/ocl/tproc/rope.hpp b/include/ocl/tproc/rope.hpp index 9a072c9..c0fd756 100644 --- a/include/ocl/tproc/rope.hpp +++ b/include/ocl/tproc/rope.hpp @@ -8,14 +8,20 @@ #include -namespace ocl::tproc +namespace ocl::tproc::rope { template - It find(It begin, It end, Pred callable); + It find(It begin, It end, Pred); template - It find_if(It begin, It end, Callable callable); + It find_if(It begin, It end, Callable); + + template + size_t erase(It begin, It end, Pred); + + template + size_t erase_if(It begin, It end, Callable); } // namespace ocl::tproc -- cgit v1.2.3