donghao526 commented on code in PR #3249:
URL: https://github.com/apache/kvrocks/pull/3249#discussion_r2523032858


##########
src/types/redis_tdigest.cc:
##########
@@ -93,11 +101,59 @@ class DummyCentroids {
     const std::vector<Centroid>& centroids_;
   };
 
-  std::unique_ptr<Iterator> Begin() { return 
std::make_unique<Iterator>(centroids_.cbegin(), centroids_); }
-  std::unique_ptr<Iterator> End() {
+  class ReverseIterator final : public BaseIterator {
+   public:
+    ReverseIterator(std::vector<Centroid>::const_reverse_iterator&& iter, 
const std::vector<Centroid>& centroids)

Review Comment:
   > Current implementation is ok to me. If we want a cleaner implementation, 
maybe we could use crtp to constraint the 
`std::vector<Centroid>::const_reverse_iterator` as an compile time interface 
with `cbegin()` and `cend()`. This is optional.
   
   @LindaSummer Since I am not very familiar with CRTP, modifying this code 
will take some time. If possible, I can submit the changes in a new PR later.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to