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/07/22 22:55:32 UTC

[incubator-datasketches-cpp] 02/03: no need to check for zero, rearranged order

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

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

commit 3f1f5790f5425a4bec5e7911dab61ccbf17a41d0
Author: AlexanderSaydakov <Al...@users.noreply.github.com>
AuthorDate: Wed Jul 22 15:53:27 2020 -0700

    no need to check for zero, rearranged order
---
 tuple/include/tuple_sketch_impl.hpp | 30 ++++++++++++++----------------
 1 file changed, 14 insertions(+), 16 deletions(-)

diff --git a/tuple/include/tuple_sketch_impl.hpp b/tuple/include/tuple_sketch_impl.hpp
index 7178e50..f0c5b50 100644
--- a/tuple/include/tuple_sketch_impl.hpp
+++ b/tuple/include/tuple_sketch_impl.hpp
@@ -70,9 +70,7 @@ string<A> tuple_sketch<S, A>::to_string(bool detail) const {
   if (detail) {
     os << "### Retained entries" << std::endl;
     for (const auto& it: *this) {
-      if (it.first != 0) {
-        os << it.first << ": " << it.second << std::endl;
-      }
+      os << it.first << ": " << it.second << std::endl;
     }
     os << "### End retained entries" << std::endl;
   }
@@ -129,13 +127,6 @@ auto update_tuple_sketch<S, U, P, A>::get_rf() const -> resize_factor {
 
 template<typename S, typename U, typename P, typename A>
 template<typename UU>
-void update_tuple_sketch<S, U, P, A>::update(const std::string& key, UU&& value) {
-  if (key.empty()) return;
-  update(key.c_str(), key.length(), std::forward<UU>(value));
-}
-
-template<typename S, typename U, typename P, typename A>
-template<typename UU>
 void update_tuple_sketch<S, U, P, A>::update(uint64_t key, UU&& value) {
   update(&key, sizeof(key), std::forward<UU>(value));
 }
@@ -178,20 +169,27 @@ void update_tuple_sketch<S, U, P, A>::update(uint8_t key, UU&& value) {
 
 template<typename S, typename U, typename P, typename A>
 template<typename UU>
-void update_tuple_sketch<S, U, P, A>::update(double key, UU&& value) {
-  update(canonical_double(key), std::forward<UU>(value));
+void update_tuple_sketch<S, U, P, A>::update(int8_t key, UU&& value) {
+  update(static_cast<int64_t>(key), std::forward<UU>(value));
 }
 
 template<typename S, typename U, typename P, typename A>
 template<typename UU>
-void update_tuple_sketch<S, U, P, A>::update(float key, UU&& value) {
-  update(static_cast<double>(key), std::forward<UU>(value));
+void update_tuple_sketch<S, U, P, A>::update(const std::string& key, UU&& value) {
+  if (key.empty()) return;
+  update(key.c_str(), key.length(), std::forward<UU>(value));
 }
 
 template<typename S, typename U, typename P, typename A>
 template<typename UU>
-void update_tuple_sketch<S, U, P, A>::update(int8_t key, UU&& value) {
-  update(static_cast<int64_t>(key), std::forward<UU>(value));
+void update_tuple_sketch<S, U, P, A>::update(double key, UU&& value) {
+  update(canonical_double(key), std::forward<UU>(value));
+}
+
+template<typename S, typename U, typename P, typename A>
+template<typename UU>
+void update_tuple_sketch<S, U, P, A>::update(float key, UU&& value) {
+  update(static_cast<double>(key), std::forward<UU>(value));
 }
 
 template<typename S, typename U, typename P, typename A>


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