You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by al...@apache.org on 2020/05/27 23:15:45 UTC

[incubator-datasketches-cpp] branch fi_deleter_fix created (now e6c19cf)

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

alsay pushed a change to branch fi_deleter_fix
in repository https://gitbox.apache.org/repos/asf/incubator-datasketches-cpp.git.


      at e6c19cf  fixed deleter

This branch includes the following new commits:

     new e6c19cf  fixed deleter

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



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


[incubator-datasketches-cpp] 01/01: fixed deleter

Posted by al...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

alsay pushed a commit to branch fi_deleter_fix
in repository https://gitbox.apache.org/repos/asf/incubator-datasketches-cpp.git

commit e6c19cff587fa20667d8525d768bf91b634aae0a
Author: AlexanderSaydakov <Al...@users.noreply.github.com>
AuthorDate: Wed May 27 16:15:25 2020 -0700

    fixed deleter
---
 fi/include/frequent_items_sketch_impl.hpp | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/fi/include/frequent_items_sketch_impl.hpp b/fi/include/frequent_items_sketch_impl.hpp
index 91a0152..bb05aa9 100644
--- a/fi/include/frequent_items_sketch_impl.hpp
+++ b/fi/include/frequent_items_sketch_impl.hpp
@@ -313,10 +313,9 @@ frequent_items_sketch<T, W, H, E, S, A> frequent_items_sketch<T, W, H, E, S, A>:
     typedef typename std::allocator_traits<A>::template rebind_alloc<W> AllocW;
     std::vector<W, AllocW> weights(num_items);
     is.read((char*)weights.data(), sizeof(W) * num_items);
-    items_deleter deleter(num_items, false);
-    std::unique_ptr<T, items_deleter> items(A().allocate(num_items), deleter);
+    std::unique_ptr<T, items_deleter> items(A().allocate(num_items), items_deleter(num_items, false));
     S().deserialize(is, items.get(), num_items);
-    deleter.set_destroy(true); // serde did not throw, so the items must be constructed
+    items.get_deleter().set_destroy(true); // serde did not throw, so the items must be constructed
     for (uint32_t i = 0; i < num_items; i++) {
       sketch.update(std::move(items.get()[i]), weights[i]);
     }
@@ -372,11 +371,10 @@ frequent_items_sketch<T, W, H, E, S, A> frequent_items_sketch<T, W, H, E, S, A>:
     typedef typename std::allocator_traits<A>::template rebind_alloc<W> AllocW;
     std::vector<W, AllocW> weights(num_items);
     ptr += copy_from_mem(ptr, weights.data(), sizeof(W) * num_items);
-    items_deleter deleter(num_items, false);
-    std::unique_ptr<T, items_deleter> items(A().allocate(num_items), deleter);
+    std::unique_ptr<T, items_deleter> items(A().allocate(num_items), items_deleter(num_items, false));
     const size_t bytes_remaining = size - (ptr - base);
     ptr += S().deserialize(ptr, bytes_remaining, items.get(), num_items);
-    deleter.set_destroy(true); // serde did not throw, so the items must be constructed
+    items.get_deleter().set_destroy(true); // serde did not throw, so the items must be constructed
     for (uint32_t i = 0; i < num_items; i++) {
       sketch.update(std::move(items.get()[i]), weights[i]);
     }


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