You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by jm...@apache.org on 2023/11/28 23:27:44 UTC

(datasketches-cpp) 01/01: density sketch c++17 compatibility

This is an automated email from the ASF dual-hosted git repository.

jmalkin pushed a commit to branch c++17-compat
in repository https://gitbox.apache.org/repos/asf/datasketches-cpp.git

commit 136787976de5ed2dd47b88f9b760f16323270d83
Author: Jon Malkin <78...@users.noreply.github.com>
AuthorDate: Tue Nov 28 15:27:37 2023 -0800

    density sketch c++17 compatibility
    
    std::random_shuffle() is removed in c++17 so this ensures strict compatibility with the standard by using a c++11-compatible method to achieve the same goal.
---
 density/include/density_sketch_impl.hpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/density/include/density_sketch_impl.hpp b/density/include/density_sketch_impl.hpp
index 1144814..a5a5bc0 100755
--- a/density/include/density_sketch_impl.hpp
+++ b/density/include/density_sketch_impl.hpp
@@ -144,7 +144,7 @@ void density_sketch<T, K, A>::compact_level(unsigned height) {
   auto& level = levels_[height];
   std::vector<bool> bits(level.size());
   bits[0] = random_utils::random_bit();
-  std::random_shuffle(level.begin(), level.end());
+  std::shuffle(level.begin(), level.end(), random_utils::rand);
   for (unsigned i = 1; i < level.size(); ++i) {
     T delta = 0;
     for (unsigned j = 0; j < i; ++j) {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org