Skip to content

Commit 1024f01

Browse files
MaheshGPaiMahesh Pai
authored andcommitted
Addressing review comments
1 parent 866f6d0 commit 1024f01

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

tdigest/include/tdigest_impl.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -638,11 +638,11 @@ template <typename T, typename A>
638638
}
639639

640640
template<typename T, typename A>
641-
tdigest<T, A>::const_iterator::const_iterator(const tdigest& tdigest_, const bool is_end):
642-
centroids_()
641+
tdigest<T, A>::const_iterator::const_iterator(const tdigest<T, A>& tdigest_, const bool is_end):
642+
centroids_(tdigest_.get_allocator())
643643
{
644644
// Create a copy of the tdigest to generate the centroids after processing the buffered values
645-
tdigest tmp(tdigest_);
645+
tdigest<T, A> tmp(tdigest_);
646646
tmp.compress();
647647
centroids_.insert(centroids_.end(), tmp.centroids_.begin(), tmp.centroids_.end());
648648

tdigest/test/tdigest_test.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,11 +460,14 @@ TEST_CASE("iterate centroids", "[tdigest]") {
460460
}
461461

462462
auto centroid_count = 0;
463+
uint64_t total_weight = 0;
463464
for (const auto &centroid: td) {
464465
centroid_count++;
466+
total_weight += centroid.second;
465467
}
466468
// Ensure that centroids are retrieved for a case where there is buffered values
467469
REQUIRE(centroid_count == 10);
470+
REQUIRE(td.get_total_weight() == total_weight);
468471
}
469472

470473
} /* namespace datasketches */

0 commit comments

Comments
 (0)