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 2019/07/30 20:17:46 UTC

[incubator-datasketches-cpp] 01/01: some cleanup: aliases, move, no copy methods, simpler union

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

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

commit f89fd1c951f2b69c12d1bd20ba920a5ead9a285e
Author: AlexanderSaydakov <Al...@users.noreply.github.com>
AuthorDate: Tue Jul 30 13:17:28 2019 -0700

    some cleanup: aliases, move, no copy methods, simpler union
---
 hll/include/HllSketch-internal.hpp |  26 +++----
 hll/include/HllUnion-internal.hpp  | 155 +++++++++++++------------------------
 hll/include/hll.hpp                |  23 ++----
 hll/test/CouponHashSetTest.cpp     |  32 ++++----
 hll/test/CouponListTest.cpp        |  32 ++++----
 hll/test/CrossCountingTest.cpp     |   4 +-
 hll/test/HllArrayTest.cpp          |  31 ++++----
 hll/test/HllSketchTest.cpp         |  30 +++----
 hll/test/HllUnionTest.cpp          |   7 +-
 hll/test/ToFromByteArrayTest.cpp   |  26 +++----
 10 files changed, 145 insertions(+), 221 deletions(-)

diff --git a/hll/include/HllSketch-internal.hpp b/hll/include/HllSketch-internal.hpp
index e5c7a97..88f055b 100644
--- a/hll/include/HllSketch-internal.hpp
+++ b/hll/include/HllSketch-internal.hpp
@@ -84,37 +84,31 @@ HllSketch<A>::HllSketch(const HllSketch<A>& that) :
 {}
 
 template<typename A>
+HllSketch<A>::HllSketch(HllSketch<A>&& that) noexcept :
+  hllSketchImpl(nullptr)
+{
+  std::swap(hllSketchImpl, that.hllSketchImpl);
+}
+
+template<typename A>
 HllSketch<A>::HllSketch(HllSketchImpl<A>* that) :
   hllSketchImpl(that)
 {}
 
 template<typename A>
-HllSketch<A> HllSketch<A>::operator=(HllSketch<A>& other) {
+HllSketch<A> HllSketch<A>::operator=(const HllSketch<A>& other) {
   hllSketchImpl->get_deleter()(hllSketchImpl);
-  hllSketchImpl = other.hllSketchImpl->copyPtr();
+  hllSketchImpl = other.hllSketchImpl->copy();
   return *this;
 }
 
 template<typename A>
 HllSketch<A> HllSketch<A>::operator=(HllSketch<A>&& other) {
-  hllSketchImpl->get_deleter()(hllSketchImpl);
-  hllSketchImpl = std::move(other.hllSketchImpl);
-  other.hllSketchImpl = nullptr;
+  std::swap(hllSketchImpl, other.hllSketchImpl);
   return *this;
 }
 
 template<typename A>
-HllSketch<A> HllSketch<A>::copy() const {
-  HllSketch<A> sketch(hllSketchImpl->copy());
-  return sketch; // no move so copy elision can work
-}
-
-template<typename A>
-HllSketch<A>* HllSketch<A>::copyPtr() const {
-  return new (AllocHllSketch().allocate(1)) HllSketch<A>(this->hllSketchImpl->copy());
-}
-
-template<typename A>
 HllSketch<A> HllSketch<A>::copyAs(const TgtHllType tgtHllType) const {
   HllSketch<A> sketch(hllSketchImpl->copyAs(tgtHllType));
   return sketch; // no move so copy elision can work
diff --git a/hll/include/HllUnion-internal.hpp b/hll/include/HllUnion-internal.hpp
index cb5d67a..7ba198c 100644
--- a/hll/include/HllUnion-internal.hpp
+++ b/hll/include/HllUnion-internal.hpp
@@ -32,11 +32,10 @@
 namespace datasketches {
 
 template<typename A>
-HllUnion<A>::HllUnion(const int lgMaxK)
-  : lgMaxK(HllUtil<A>::checkLgK(lgMaxK)) {
-    typedef typename std::allocator_traits<A>::template rebind_alloc<HllSketch<A>> AllocHllSketch;
-    gadget = new (AllocHllSketch().allocate(1)) HllSketch<A>(lgMaxK, TgtHllType::HLL_8);
-}
+HllUnion<A>::HllUnion(const int lgMaxK):
+  lgMaxK(HllUtil<A>::checkLgK(lgMaxK)),
+  gadget(lgMaxK, TgtHllType::HLL_8)
+{}
 
 template<typename A>
 HllUnion<A> HllUnion<A>::deserialize(const void* bytes, size_t len) {
@@ -45,7 +44,7 @@ HllUnion<A> HllUnion<A>::deserialize(const void* bytes, size_t len) {
   // we can initialize the Union with it as long as it's HLL_8.
   HllUnion<A> hllUnion(sk.getLgConfigK());
   if (sk.getTgtHllType() == HLL_8) {
-    std::swap(hllUnion.gadget->hllSketchImpl, sk.hllSketchImpl);
+    std::swap(hllUnion.gadget.hllSketchImpl, sk.hllSketchImpl);
   } else {
     hllUnion.update(sk);
   }
@@ -59,7 +58,7 @@ HllUnion<A> HllUnion<A>::deserialize(std::istream& is) {
   // we can initialize the Union with it as long as it's HLL_8.
   HllUnion<A> hllUnion(sk.getLgConfigK());
   if (sk.getTgtHllType() == HLL_8) {    
-    std::swap(hllUnion.gadget->hllSketchImpl, sk.hllSketchImpl);
+    std::swap(hllUnion.gadget.hllSketchImpl, sk.hllSketchImpl);
   } else {
     hllUnion.update(sk);
   }
@@ -67,57 +66,13 @@ HllUnion<A> HllUnion<A>::deserialize(std::istream& is) {
 }
 
 template<typename A>
-HllUnion<A>::~HllUnion() {
-  if (gadget != nullptr) {
-    typedef typename std::allocator_traits<A>::template rebind_alloc<HllSketch<A>> AllocHllSketch;
-    gadget->~HllSketch();
-    AllocHllSketch().deallocate(gadget, 1);
-  }
-}
-
-template<typename A>
 static std::ostream& operator<<(std::ostream& os, const HllUnion<A>& hllUnion) {
   return hllUnion.to_string(os, true, true, false, false);
 }
 
-/*
-static std::ostream& operator<<(std::ostream& os, hll_union& hllUnion) {
-  return hllUnion->to_string(os, true, true, false, false);
-}
-*/
-
-template<typename A>
-HllUnion<A>::HllUnion(const HllUnion<A>& other) :
-  lgMaxK(other.lgMaxK),
-  gadget(other.gadget->copyPtr())
-  {}
-
-template<typename A>
-HllUnion<A> HllUnion<A>::operator=(HllUnion<A>& other) {
-  lgMaxK = other.lgMaxK;
-
-  typedef typename std::allocator_traits<A>::template rebind_alloc<HllSketch<A>> Alloc;
-  gadget->~HllSketch();
-  Alloc().deallocate(gadget, 1);
-  gadget = other.gadget->copy();
-  return *this;
-}
-
-template<typename A>
-HllUnion<A> HllUnion<A>::operator=(HllUnion<A>&& other) {
-  lgMaxK = other.lgMaxK;
-
-  typedef typename std::allocator_traits<A>::template rebind_alloc<HllSketch<A>> Alloc;
-  gadget->~HllSketch();
-  Alloc().deallocate(gadget, 1);
-  gadget = other.gadget;
-  other.gadget = nullptr;
-  return *this;
-}
-
 template<typename A>
 HllSketch<A> HllUnion<A>::getResult(TgtHllType tgtHllType) const {
-  return std::move(gadget->copyAs(tgtHllType));
+  return std::move(gadget.copyAs(tgtHllType));
 }
 
 template<typename A>
@@ -127,169 +82,169 @@ void HllUnion<A>::update(const HllSketch<A>& sketch) {
 
 template<typename A>
 void HllUnion<A>::update(const std::string& datum) {
-  gadget->update(datum);
+  gadget.update(datum);
 }
 
 template<typename A>
 void HllUnion<A>::update(const uint64_t datum) {
-  gadget->update(datum);
+  gadget.update(datum);
 }
 
 template<typename A>
 void HllUnion<A>::update(const uint32_t datum) {
-  gadget->update(datum);
+  gadget.update(datum);
 }
 
 template<typename A>
 void HllUnion<A>::update(const uint16_t datum) {
-  gadget->update(datum);
+  gadget.update(datum);
 }
 
 template<typename A>
 void HllUnion<A>::update(const uint8_t datum) {
-  gadget->update(datum);
+  gadget.update(datum);
 }
 
 template<typename A>
 void HllUnion<A>::update(const int64_t datum) {
-  gadget->update(datum);
+  gadget.update(datum);
 }
 
 template<typename A>
 void HllUnion<A>::update(const int32_t datum) {
-  gadget->update(datum);
+  gadget.update(datum);
 }
 
 template<typename A>
 void HllUnion<A>::update(const int16_t datum) {
-  gadget->update(datum);
+  gadget.update(datum);
 }
 
 template<typename A>
 void HllUnion<A>::update(const int8_t datum) {
-  gadget->update(datum);
+  gadget.update(datum);
 }
 
 template<typename A>
 void HllUnion<A>::update(const double datum) {
-  gadget->update(datum);
+  gadget.update(datum);
 }
 
 template<typename A>
 void HllUnion<A>::update(const float datum) {
-  gadget->update(datum);
+  gadget.update(datum);
 }
 
 template<typename A>
 void HllUnion<A>::update(const void* data, const size_t lengthBytes) {
-  gadget->update(data, lengthBytes);
+  gadget.update(data, lengthBytes);
 }
 
 template<typename A>
 void HllUnion<A>::couponUpdate(const int coupon) {
   if (coupon == HllUtil<A>::EMPTY) { return; }
-  HllSketchImpl<A>* result = gadget->hllSketchImpl->couponUpdate(coupon);
-  if (result != gadget->hllSketchImpl) {
-    if (gadget->hllSketchImpl != nullptr) { gadget->hllSketchImpl->get_deleter()(gadget->hllSketchImpl); }
-    gadget->hllSketchImpl = result;
+  HllSketchImpl<A>* result = gadget.hllSketchImpl->couponUpdate(coupon);
+  if (result != gadget.hllSketchImpl) {
+    if (gadget.hllSketchImpl != nullptr) { gadget.hllSketchImpl->get_deleter()(gadget.hllSketchImpl); }
+    gadget.hllSketchImpl = result;
   }
 }
 
 template<typename A>
 std::pair<std::unique_ptr<uint8_t, std::function<void(uint8_t*)>>, const size_t> HllUnion<A>::serializeCompact() const {
-  return gadget->serializeCompact();
+  return gadget.serializeCompact();
 }
 
 template<typename A>
 std::pair<std::unique_ptr<uint8_t, std::function<void(uint8_t*)>>, const size_t> HllUnion<A>::serializeUpdatable() const {
-  return gadget->serializeUpdatable();
+  return gadget.serializeUpdatable();
 }
 
 template<typename A>
 void HllUnion<A>::serializeCompact(std::ostream& os) const {
-  return gadget->serializeCompact(os);
+  return gadget.serializeCompact(os);
 }
 
 template<typename A>
 void HllUnion<A>::serializeUpdatable(std::ostream& os) const {
-  return gadget->serializeUpdatable(os);
+  return gadget.serializeUpdatable(os);
 }
 
 template<typename A>
 std::ostream& HllUnion<A>::to_string(std::ostream& os, const bool summary,
                                   const bool detail, const bool auxDetail, const bool all) const {
-  return gadget->to_string(os, summary, detail, auxDetail, all);
+  return gadget.to_string(os, summary, detail, auxDetail, all);
 }
 
 template<typename A>
 std::string HllUnion<A>::to_string(const bool summary, const bool detail,
                                    const bool auxDetail, const bool all) const {
-  return gadget->to_string(summary, detail, auxDetail, all);
+  return gadget.to_string(summary, detail, auxDetail, all);
 }
 
 template<typename A>
 double HllUnion<A>::getEstimate() const {
-  return gadget->getEstimate();
+  return gadget.getEstimate();
 }
 
 template<typename A>
 double HllUnion<A>::getCompositeEstimate() const {
-  return gadget->getCompositeEstimate();
+  return gadget.getCompositeEstimate();
 }
 
 template<typename A>
 double HllUnion<A>::getLowerBound(const int numStdDev) const {
-  return gadget->getLowerBound(numStdDev);
+  return gadget.getLowerBound(numStdDev);
 }
 
 template<typename A>
 double HllUnion<A>::getUpperBound(const int numStdDev) const {
-  return gadget->getUpperBound(numStdDev);
+  return gadget.getUpperBound(numStdDev);
 }
 
 template<typename A>
 int HllUnion<A>::getCompactSerializationBytes() const {
-  return gadget->getCompactSerializationBytes();
+  return gadget.getCompactSerializationBytes();
 }
 
 template<typename A>
 int HllUnion<A>::getUpdatableSerializationBytes() const {
-  return gadget->getUpdatableSerializationBytes();
+  return gadget.getUpdatableSerializationBytes();
 }
 
 template<typename A>
 int HllUnion<A>::getLgConfigK() const {
-  return gadget->getLgConfigK();
+  return gadget.getLgConfigK();
 }
 
 template<typename A>
 void HllUnion<A>::reset() {
-  gadget->reset();
+  gadget.reset();
 }
 
 template<typename A>
 bool HllUnion<A>::isCompact() const {
-  return gadget->isCompact();
+  return gadget.isCompact();
 }
 
 template<typename A>
 bool HllUnion<A>::isEmpty() const {
-  return gadget->isEmpty();
+  return gadget.isEmpty();
 }
 
 template<typename A>
 bool HllUnion<A>::isOutOfOrderFlag() const {
-  return gadget->isOutOfOrderFlag();
+  return gadget.isOutOfOrderFlag();
 }
 
 template<typename A>
 CurMode HllUnion<A>::getCurrentMode() const {
-  return gadget->getCurrentMode();
+  return gadget.getCurrentMode();
 }
 
 template<typename A>
 bool HllUnion<A>::isEstimationMode() const {
-  return gadget->isEstimationMode();
+  return gadget.isEstimationMode();
 }
 
 template<typename A>
@@ -347,16 +302,16 @@ inline HllSketchImpl<A>* HllUnion<A>::leakFreeCouponUpdate(HllSketchImpl<A>* imp
 
 template<typename A>
 void HllUnion<A>::unionImpl(HllSketchImpl<A>* incomingImpl, const int lgMaxK) {
-  if (gadget->hllSketchImpl->getTgtHllType() != TgtHllType::HLL_8) {
+  if (gadget.hllSketchImpl->getTgtHllType() != TgtHllType::HLL_8) {
     throw std::logic_error("Must call unionImpl() with HLL_8 input");
   }
   HllSketchImpl<A>* srcImpl = incomingImpl; //default
-  HllSketchImpl<A>* dstImpl = gadget->hllSketchImpl; //default
+  HllSketchImpl<A>* dstImpl = gadget.hllSketchImpl; //default
   if ((incomingImpl == nullptr) || incomingImpl->isEmpty()) {
-    return; // gadget->hllSketchImpl;
+    return; // gadget.hllSketchImpl;
   }
 
-  const int hi2bits = (gadget->hllSketchImpl->isEmpty()) ? 3 : gadget->hllSketchImpl->getCurMode();
+  const int hi2bits = (gadget.hllSketchImpl->isEmpty()) ? 3 : gadget.hllSketchImpl->getCurMode();
   const int lo2bits = incomingImpl->getCurMode();
 
   const int sw = (hi2bits << 2) | lo2bits;
@@ -385,7 +340,7 @@ void HllUnion<A>::unionImpl(HllSketchImpl<A>* incomingImpl, const int lgMaxK) {
     case 2: { //src: HLL, gadget: LIST
       //swap so that src is gadget-LIST, tgt is HLL
       //use lgMaxK because LIST has effective K of 2^26
-      srcImpl = gadget->hllSketchImpl;
+      srcImpl = gadget.hllSketchImpl;
       dstImpl = copyOrDownsampleHll(incomingImpl, lgMaxK);
       PairIterator_with_deleter<A> srcItr = srcImpl->getIterator();
       while (srcItr->nextValid()) {
@@ -394,7 +349,7 @@ void HllUnion<A>::unionImpl(HllSketchImpl<A>* incomingImpl, const int lgMaxK) {
       //whichever is True wins:
       dstImpl->putOutOfOrderFlag(srcImpl->isOutOfOrderFlag() | dstImpl->isOutOfOrderFlag());
       // gadget: swapped, replacing with new impl
-      gadget->hllSketchImpl->get_deleter()(gadget->hllSketchImpl);
+      gadget.hllSketchImpl->get_deleter()(gadget.hllSketchImpl);
       break;
     }
     case 4: { //src: LIST, gadget: SET
@@ -418,7 +373,7 @@ void HllUnion<A>::unionImpl(HllSketchImpl<A>* incomingImpl, const int lgMaxK) {
     case 6: { //src: HLL, gadget: SET
       //swap so that src is gadget-SET, tgt is HLL
       //use lgMaxK because LIST has effective K of 2^26
-      srcImpl = gadget->hllSketchImpl;
+      srcImpl = gadget.hllSketchImpl;
       dstImpl = copyOrDownsampleHll(incomingImpl, lgMaxK);
       PairIterator_with_deleter<A> srcItr = srcImpl->getIterator(); //LIST
       if (dstImpl->getCurMode() != HLL) {
@@ -429,7 +384,7 @@ void HllUnion<A>::unionImpl(HllSketchImpl<A>* incomingImpl, const int lgMaxK) {
       }
       dstImpl->putOutOfOrderFlag(true); //merging SET into non-empty HLL -> true
       // gadget: swapped, replacing with new impl
-      gadget->hllSketchImpl->get_deleter()(gadget->hllSketchImpl);
+      gadget.hllSketchImpl->get_deleter()(gadget.hllSketchImpl);
       break;
     }
     case 8: { //src: LIST, gadget: HLL
@@ -443,7 +398,7 @@ void HllUnion<A>::unionImpl(HllSketchImpl<A>* incomingImpl, const int lgMaxK) {
       //whichever is True wins:
       dstImpl->putOutOfOrderFlag(dstImpl->isOutOfOrderFlag() | srcImpl->isOutOfOrderFlag());
       // gadget: should remain unchanged
-      if (dstImpl != gadget->hllSketchImpl) {
+      if (dstImpl != gadget.hllSketchImpl) {
         // should not have changed from HLL
         throw std::logic_error("dstImpl unepxectedly changed from gadget");
       } 
@@ -459,7 +414,7 @@ void HllUnion<A>::unionImpl(HllSketchImpl<A>* incomingImpl, const int lgMaxK) {
       }
       dstImpl->putOutOfOrderFlag(true); //merging SET into existing HLL -> true
       // gadget: should remain unchanged
-      if (dstImpl != gadget->hllSketchImpl) {
+      if (dstImpl != gadget.hllSketchImpl) {
         // should not have changed from HLL
         throw std::logic_error("dstImpl unepxectedly changed from gadget");
       } 
@@ -472,7 +427,7 @@ void HllUnion<A>::unionImpl(HllSketchImpl<A>* incomingImpl, const int lgMaxK) {
       if ((srcLgK < dstLgK) || (dstImpl->getTgtHllType() != HLL_8)) {
         dstImpl = copyOrDownsampleHll(dstImpl, minLgK);
         // always replaces gadget
-        gadget->hllSketchImpl->get_deleter()(gadget->hllSketchImpl);
+        gadget.hllSketchImpl->get_deleter()(gadget.hllSketchImpl);
       }
       PairIterator_with_deleter<A> srcItr = srcImpl->getIterator(); //HLL
       while (srcItr->nextValid()) {
@@ -504,12 +459,12 @@ void HllUnion<A>::unionImpl(HllSketchImpl<A>* incomingImpl, const int lgMaxK) {
       dstImpl = copyOrDownsampleHll(srcImpl, lgMaxK);
       dstImpl->putOutOfOrderFlag(srcImpl->isOutOfOrderFlag()); //whatever source is.
       // gadget: always replaced with copied/downsampled sketch
-      gadget->hllSketchImpl->get_deleter()(gadget->hllSketchImpl);
+      gadget.hllSketchImpl->get_deleter()(gadget.hllSketchImpl);
       break;
     }
   }
   
-  gadget->hllSketchImpl = dstImpl;
+  gadget.hllSketchImpl = dstImpl;
 }
 
 }
diff --git a/hll/include/hll.hpp b/hll/include/hll.hpp
index 7245bd7..f69458d 100644
--- a/hll/include/hll.hpp
+++ b/hll/include/hll.hpp
@@ -50,13 +50,12 @@ class HllSketch final {
     static HllSketch deserialize(std::istream& is);
     static HllSketch deserialize(const void* bytes, size_t len);
     HllSketch(const HllSketch<A>& that);
+    HllSketch(HllSketch<A>&& that) noexcept;
 
     ~HllSketch();
 
-    HllSketch operator=(HllSketch<A>& other);
+    HllSketch operator=(const HllSketch<A>& other);
     HllSketch operator=(HllSketch<A>&& other);
-    HllSketch copy() const;
-    HllSketch* copyPtr() const;
     HllSketch copyAs(TgtHllType tgtHllType) const;
 
     void reset();
@@ -143,20 +142,11 @@ class HllSketch final {
 template<typename A = std::allocator<char> >
 class HllUnion {
   public:
-    //static HllUnion newInstance(int lgMaxK);
     explicit HllUnion(int lgMaxK);
-    //explicit HllUnion(HllSketch<A>& sketch);
-    //explicit HllUnion(HllSketch<A>&& sketch);
-    HllUnion(const HllUnion<A>& that);
 
     static HllUnion deserialize(std::istream& is);
     static HllUnion deserialize(const void* bytes, size_t len);
 
-    ~HllUnion();
-
-    HllUnion operator=(HllUnion<A>& other);
-    HllUnion operator=(HllUnion<A>&& other);
-
     double getEstimate() const;
     double getCompositeEstimate() const;
     double getLowerBound(int numStdDev) const;
@@ -208,7 +198,6 @@ class HllUnion {
                             int lgConfigK, int numStdDev);
 
   private:
-    typedef typename std::allocator_traits<A>::template rebind_alloc<HllUnion> AllocHllUnion;
 
    /**
     * Union the given source and destination sketches. This static method examines the state of
@@ -238,7 +227,7 @@ class HllUnion {
     static HllSketchImpl<A>* leakFreeCouponUpdate(HllSketchImpl<A>* impl, int coupon);
 
     int lgMaxK;
-    HllSketch<A>* gadget;
+    HllSketch<A> gadget;
 
 };
 
@@ -248,10 +237,12 @@ static std::ostream& operator<<(std::ostream& os, const HllSketch<A>& sketch);
 template<typename A>
 static std::ostream& operator<<(std::ostream& os, const HllUnion<A>& hllUnion);
 
+// aliases with default allocator for convenience
+typedef HllSketch<> hll_sketch;
+typedef HllUnion<> hll_union;
+
 } // namespace datasketches
 
 #include "hll.private.hpp"
-//#include "HllSketch.hpp"
-//#include "HllUnion.hpp"
 
 #endif // _HLL_HPP_
diff --git a/hll/test/CouponHashSetTest.cpp b/hll/test/CouponHashSetTest.cpp
index 051593c..117cbc3 100644
--- a/hll/test/CouponHashSetTest.cpp
+++ b/hll/test/CouponHashSetTest.cpp
@@ -39,7 +39,7 @@ class CouponHashSetTest : public CppUnit::TestFixture {
 
   void checkCorruptBytearray() {
     int lgK = 8;
-    HllSketch<> sk1(lgK);
+    hll_sketch sk1(lgK);
     for (int i = 0; i < 24; ++i) {
       sk1.update(i);
     }
@@ -49,7 +49,7 @@ class CouponHashSetTest : public CppUnit::TestFixture {
     bytes[HllUtil<>::PREAMBLE_INTS_BYTE] = 0;
     // fail in HllSketchImpl
     CPPUNIT_ASSERT_THROW_MESSAGE("Failed to detect error in preInts byte",
-                                 HllSketch<>::deserialize(bytes, sketchBytes.second),
+                                 hll_sketch::deserialize(bytes, sketchBytes.second),
                                  std::invalid_argument);
     // fail in CouponHashSet
     CPPUNIT_ASSERT_THROW_MESSAGE("Failed to detect error in preInts byte",
@@ -59,46 +59,46 @@ class CouponHashSetTest : public CppUnit::TestFixture {
 
     bytes[HllUtil<>::SER_VER_BYTE] = 0;
     CPPUNIT_ASSERT_THROW_MESSAGE("Failed to detect error in serialization version byte",
-                                 HllSketch<>::deserialize(bytes, sketchBytes.second),
+                                 hll_sketch::deserialize(bytes, sketchBytes.second),
                                  std::invalid_argument);
     bytes[HllUtil<>::SER_VER_BYTE] = HllUtil<>::SER_VER;
 
     bytes[HllUtil<>::FAMILY_BYTE] = 0;
     CPPUNIT_ASSERT_THROW_MESSAGE("Failed to detect error in family id byte",
-                                 HllSketch<>::deserialize(bytes, sketchBytes.second),
+                                 hll_sketch::deserialize(bytes, sketchBytes.second),
                                  std::invalid_argument);
     bytes[HllUtil<>::FAMILY_BYTE] = HllUtil<>::FAMILY_ID;
 
     bytes[HllUtil<>::LG_K_BYTE] = 6;
     CPPUNIT_ASSERT_THROW_MESSAGE("Failed to detect too small a lgK for Set mode",
-                                 HllSketch<>::deserialize(bytes, sketchBytes.second),
+                                 hll_sketch::deserialize(bytes, sketchBytes.second),
                                  std::invalid_argument);
     bytes[HllUtil<>::LG_K_BYTE] = lgK;
 
     uint8_t tmp = bytes[HllUtil<>::MODE_BYTE];
     bytes[HllUtil<>::MODE_BYTE] = 0x10; // HLL_6, LIST
     CPPUNIT_ASSERT_THROW_MESSAGE("Failed to detect error in mode byte",
-                                 HllSketch<>::deserialize(bytes, sketchBytes.second),
+                                 hll_sketch::deserialize(bytes, sketchBytes.second),
                                  std::invalid_argument);
     bytes[HllUtil<>::MODE_BYTE] = tmp;
 
     tmp = bytes[HllUtil<>::LG_ARR_BYTE];
     bytes[HllUtil<>::LG_ARR_BYTE] = 0;
-    HllSketch<>::deserialize(bytes, sketchBytes.second);
+    hll_sketch::deserialize(bytes, sketchBytes.second);
     // should work fine despite the corruption
     bytes[HllUtil<>::LG_ARR_BYTE] = tmp;
 
     CPPUNIT_ASSERT_THROW_MESSAGE("Failed to detect error in serialized length",
-                                 HllSketch<>::deserialize(bytes, sketchBytes.second - 1),
+                                 hll_sketch::deserialize(bytes, sketchBytes.second - 1),
                                  std::invalid_argument);
     CPPUNIT_ASSERT_THROW_MESSAGE("Failed to detect error in serialized length",
-                                 HllSketch<>::deserialize(bytes, 3),
+                                 hll_sketch::deserialize(bytes, 3),
                                  std::invalid_argument);
   }
 
   void checkCorruptStream() {
     int lgK = 9;
-    HllSketch<> sk1(lgK);
+    hll_sketch sk1(lgK);
     for (int i = 0; i < 24; ++i) {
       sk1.update(i);
     }
@@ -110,7 +110,7 @@ class CouponHashSetTest : public CppUnit::TestFixture {
     ss.seekg(0);
     // fail in HllSketchImpl
     CPPUNIT_ASSERT_THROW_MESSAGE("Failed to detect error in preInts byte",
-                                 HllSketch<>::deserialize(ss),
+                                 hll_sketch::deserialize(ss),
                                  std::invalid_argument);
     // fail in CouponHashSet
     CPPUNIT_ASSERT_THROW_MESSAGE("Failed to detect error in preInts byte",
@@ -123,7 +123,7 @@ class CouponHashSetTest : public CppUnit::TestFixture {
     ss.put(0);
     ss.seekg(0);
     CPPUNIT_ASSERT_THROW_MESSAGE("Failed to detect error in serialization version byte",
-                                 HllSketch<>::deserialize(ss),
+                                 hll_sketch::deserialize(ss),
                                  std::invalid_argument);
     ss.seekp(HllUtil<>::SER_VER_BYTE);
     ss.put(HllUtil<>::SER_VER);
@@ -132,7 +132,7 @@ class CouponHashSetTest : public CppUnit::TestFixture {
     ss.put(0);
     ss.seekg(0);
     CPPUNIT_ASSERT_THROW_MESSAGE("Failed to detect error in family id byte",
-                                 HllSketch<>::deserialize(ss),
+                                 hll_sketch::deserialize(ss),
                                  std::invalid_argument);
     ss.seekp(HllUtil<>::FAMILY_BYTE);
     ss.put(HllUtil<>::FAMILY_ID);
@@ -143,7 +143,7 @@ class CouponHashSetTest : public CppUnit::TestFixture {
     ss.put(0x22); // HLL_8, HLL
     ss.seekg(0);
     CPPUNIT_ASSERT_THROW_MESSAGE("Failed to detect error in mode byte",
-                                 HllSketch<>::deserialize(ss),
+                                 hll_sketch::deserialize(ss),
                                  std::invalid_argument);
     ss.seekp(HllUtil<>::MODE_BYTE);
     ss.put(tmp);
@@ -153,7 +153,7 @@ class CouponHashSetTest : public CppUnit::TestFixture {
     ss.seekp(HllUtil<>::LG_ARR_BYTE);
     ss.put(0);
     ss.seekg(0);
-    HllSketch<>::deserialize(ss);
+    hll_sketch::deserialize(ss);
     // should work fine despite the corruption
     ss.seekp(HllUtil<>::LG_ARR_BYTE);
     ss.put(tmp);
@@ -162,4 +162,4 @@ class CouponHashSetTest : public CppUnit::TestFixture {
 
 CPPUNIT_TEST_SUITE_REGISTRATION(CouponHashSetTest);
 
-} // namespace datasketches
\ No newline at end of file
+} // namespace datasketches
diff --git a/hll/test/CouponListTest.cpp b/hll/test/CouponListTest.cpp
index 3d3b0b3..714124f 100644
--- a/hll/test/CouponListTest.cpp
+++ b/hll/test/CouponListTest.cpp
@@ -65,7 +65,7 @@ class CouponListTest : public CppUnit::TestFixture {
 
   void checkDuplicatesAndMisc() {
     int lgConfigK = 8;
-    HllSketch<> sk(lgConfigK);
+    hll_sketch sk(lgConfigK);
 
     for (int i = 1; i <= 7; ++i) {
       sk.update(i);
@@ -103,7 +103,7 @@ class CouponListTest : public CppUnit::TestFixture {
   }
 
   void serializeDeserialize(const int lgK) {
-    HllSketch<> sk1(lgK);
+    hll_sketch sk1(lgK);
 
     int u = (lgK < 8) ? 7 : (((1 << (lgK - 3))/ 4) * 3);
     for (int i = 0; i < u; ++i) {
@@ -114,7 +114,7 @@ class CouponListTest : public CppUnit::TestFixture {
 
     std::stringstream ss(std::ios::in | std::ios::out | std::ios::binary);
     sk1.serializeCompact(ss);
-    HllSketch<> sk2 = HllSketch<>::deserialize(ss);
+    hll_sketch sk2 = hll_sketch::deserialize(ss);
     double est2 = sk2.getEstimate();
     CPPUNIT_ASSERT_DOUBLES_EQUAL(est2, est1, 0.0);
 
@@ -122,7 +122,7 @@ class CouponListTest : public CppUnit::TestFixture {
     ss.clear();
 
     sk1.serializeUpdatable(ss);
-    sk2 = HllSketch<>::deserialize(ss);
+    sk2 = hll_sketch::deserialize(ss);
     est2 = sk2.getEstimate();
     CPPUNIT_ASSERT_DOUBLES_EQUAL(est2, est1, 0.0);
   }
@@ -134,7 +134,7 @@ class CouponListTest : public CppUnit::TestFixture {
 
   void checkCorruptBytearrayData() {
     int lgK = 6;
-    HllSketch<> sk1(lgK);
+    hll_sketch sk1(lgK);
     sk1.update(1);
     sk1.update(2);
     std::pair<byte_ptr_with_deleter, const size_t> sketchBytes = sk1.serializeCompact();
@@ -142,7 +142,7 @@ class CouponListTest : public CppUnit::TestFixture {
 
     bytes[HllUtil<>::PREAMBLE_INTS_BYTE] = 0;
     CPPUNIT_ASSERT_THROW_MESSAGE("Failed to detect error in preInts byte",
-                                 HllSketch<>::deserialize(bytes, sketchBytes.second),
+                                 hll_sketch::deserialize(bytes, sketchBytes.second),
                                  std::invalid_argument);
     CPPUNIT_ASSERT_THROW_MESSAGE("Failed to detect error in preInts byte",
                                  CouponList<>::newList(bytes, sketchBytes.second),
@@ -152,35 +152,35 @@ class CouponListTest : public CppUnit::TestFixture {
 
     bytes[HllUtil<>::SER_VER_BYTE] = 0;
     CPPUNIT_ASSERT_THROW_MESSAGE("Failed to detect error in serialization version byte",
-                                 HllSketch<>::deserialize(bytes, sketchBytes.second),
+                                 hll_sketch::deserialize(bytes, sketchBytes.second),
                                  std::invalid_argument);
     bytes[HllUtil<>::SER_VER_BYTE] = HllUtil<>::SER_VER;
 
     bytes[HllUtil<>::FAMILY_BYTE] = 0;
     CPPUNIT_ASSERT_THROW_MESSAGE("Failed to detect error in family id byte",
-                                 HllSketch<>::deserialize(bytes, sketchBytes.second),
+                                 hll_sketch::deserialize(bytes, sketchBytes.second),
                                  std::invalid_argument);
     bytes[HllUtil<>::FAMILY_BYTE] = HllUtil<>::FAMILY_ID;
 
     uint8_t tmp = bytes[HllUtil<>::MODE_BYTE];
     bytes[HllUtil<>::MODE_BYTE] = 0x01; // HLL_4, SET
     CPPUNIT_ASSERT_THROW_MESSAGE("Failed to detect error in mode byte",
-                                 HllSketch<>::deserialize(bytes, sketchBytes.second),
+                                 hll_sketch::deserialize(bytes, sketchBytes.second),
                                  std::invalid_argument);
     bytes[HllUtil<>::MODE_BYTE] = tmp;
 
     CPPUNIT_ASSERT_THROW_MESSAGE("Failed to detect error in serialized length",
-                                 HllSketch<>::deserialize(bytes, sketchBytes.second - 1),
+                                 hll_sketch::deserialize(bytes, sketchBytes.second - 1),
                                  std::invalid_argument);
 
     CPPUNIT_ASSERT_THROW_MESSAGE("Failed to detect error in serialized length",
-                                 HllSketch<>::deserialize(bytes, 3),
+                                 hll_sketch::deserialize(bytes, 3),
                                  std::invalid_argument);
   }
 
   void checkCorruptStreamData() {
     int lgK = 6;
-    HllSketch<> sk1(lgK);
+    hll_sketch sk1(lgK);
     sk1.update(1);
     sk1.update(2);
     std::stringstream ss;
@@ -190,7 +190,7 @@ class CouponListTest : public CppUnit::TestFixture {
     ss.put(0);
     ss.seekg(0);
     CPPUNIT_ASSERT_THROW_MESSAGE("Failed to detect error in preInts byte",
-                                 HllSketch<>::deserialize(ss),
+                                 hll_sketch::deserialize(ss),
                                  std::invalid_argument);
     CPPUNIT_ASSERT_THROW_MESSAGE("Failed to detect error in preInts byte",
                                  CouponList<>::newList(ss),
@@ -202,7 +202,7 @@ class CouponListTest : public CppUnit::TestFixture {
     ss.put(0);
     ss.seekg(0);
     CPPUNIT_ASSERT_THROW_MESSAGE("Failed to detect error in serialization version byte",
-                                 HllSketch<>::deserialize(ss),
+                                 hll_sketch::deserialize(ss),
                                  std::invalid_argument);
     ss.seekp(HllUtil<>::SER_VER_BYTE);
     ss.put(HllUtil<>::SER_VER);
@@ -211,7 +211,7 @@ class CouponListTest : public CppUnit::TestFixture {
     ss.put(0);
     ss.seekg(0);
     CPPUNIT_ASSERT_THROW_MESSAGE("Failed to detect error in family id byte",
-                                 HllSketch<>::deserialize(ss),
+                                 hll_sketch::deserialize(ss),
                                  std::invalid_argument);
     ss.seekp(HllUtil<>::FAMILY_BYTE);
     ss.put(HllUtil<>::FAMILY_ID);
@@ -220,7 +220,7 @@ class CouponListTest : public CppUnit::TestFixture {
     ss.put(0x22); // HLL_8, HLL
     ss.seekg(0);
     CPPUNIT_ASSERT_THROW_MESSAGE("Failed to detect error in mode bytes",
-                                 HllSketch<>::deserialize(ss),
+                                 hll_sketch::deserialize(ss),
                                  std::invalid_argument);
   }
 
diff --git a/hll/test/CrossCountingTest.cpp b/hll/test/CrossCountingTest.cpp
index bf11682..23504fc 100644
--- a/hll/test/CrossCountingTest.cpp
+++ b/hll/test/CrossCountingTest.cpp
@@ -36,8 +36,6 @@ class CrossCountingTest : public CppUnit::TestFixture {
   CPPUNIT_TEST(crossCountingChecks);
   CPPUNIT_TEST_SUITE_END();
 
-  typedef HllSketch<> hll_sketch;
-
   hll_sketch buildSketch(const int n, const int lgK, const TgtHllType tgtHllType) {
     hll_sketch sketch(lgK, tgtHllType);
     for (int i = 0; i < n; ++i) {
@@ -46,7 +44,7 @@ class CrossCountingTest : public CppUnit::TestFixture {
     return sketch;
   }
 
-  int computeChecksum(const HllSketch<>& sketch) {
+  int computeChecksum(const hll_sketch& sketch) {
     PairIterator_with_deleter<> itr = sketch.getIterator();
     int checksum = 0;
     int key;
diff --git a/hll/test/HllArrayTest.cpp b/hll/test/HllArrayTest.cpp
index d011fb2..0658110 100644
--- a/hll/test/HllArrayTest.cpp
+++ b/hll/test/HllArrayTest.cpp
@@ -38,9 +38,6 @@ class HllArrayTest : public CppUnit::TestFixture {
   CPPUNIT_TEST(checkCorruptStream);
   CPPUNIT_TEST_SUITE_END();
 
-  typedef HllSketch<> hll_sketch;
-  typedef HllUnion<> hll_union;
-
   void testComposite(const int lgK, const TgtHllType tgtHllType, const int n) {
     hll_union u(lgK);
     hll_sketch sk(lgK, tgtHllType);
@@ -95,12 +92,12 @@ class HllArrayTest : public CppUnit::TestFixture {
     // serialize as compact and updatable, deserialize, compare estimates are exact
     std::stringstream ss(std::ios::in | std::ios::out | std::ios::binary);
     sk1.serializeCompact(ss);
-    hll_sketch sk2 = HllSketch<>::deserialize(ss);
+    hll_sketch sk2 = hll_sketch::deserialize(ss);
     CPPUNIT_ASSERT_DOUBLES_EQUAL(sk2.getEstimate(), sk1.getEstimate(), 0.0);
 
     ss.clear();
     sk1.serializeUpdatable(ss);
-    sk2 = HllSketch<>::deserialize(ss);
+    sk2 = hll_sketch::deserialize(ss);
     CPPUNIT_ASSERT_DOUBLES_EQUAL(sk2.getEstimate(), sk1.getEstimate(), 0.0);
 
     sk1.reset();
@@ -126,7 +123,7 @@ class HllArrayTest : public CppUnit::TestFixture {
 
     bytes[HllUtil<>::PREAMBLE_INTS_BYTE] = 0;
     CPPUNIT_ASSERT_THROW_MESSAGE("Failed to detect error in preInts byte",
-                                 HllSketch<>::deserialize(bytes, sketchBytes.second),
+                                 hll_sketch::deserialize(bytes, sketchBytes.second),
                                  std::invalid_argument);
     CPPUNIT_ASSERT_THROW_MESSAGE("Failed to detect error in preInts byte",
                                  HllArray<>::newHll(bytes, sketchBytes.second),
@@ -135,34 +132,34 @@ class HllArrayTest : public CppUnit::TestFixture {
 
     bytes[HllUtil<>::SER_VER_BYTE] = 0;
     CPPUNIT_ASSERT_THROW_MESSAGE("Failed to detect error in serialization version byte",
-                                 HllSketch<>::deserialize(bytes, sketchBytes.second),
+                                 hll_sketch::deserialize(bytes, sketchBytes.second),
                                  std::invalid_argument);
     bytes[HllUtil<>::SER_VER_BYTE] = HllUtil<>::SER_VER;
 
     bytes[HllUtil<>::FAMILY_BYTE] = 0;
     CPPUNIT_ASSERT_THROW_MESSAGE("Failed to detect error in family id byte",
-                                 HllSketch<>::deserialize(bytes, sketchBytes.second),
+                                 hll_sketch::deserialize(bytes, sketchBytes.second),
                                  std::invalid_argument);
     bytes[HllUtil<>::FAMILY_BYTE] = HllUtil<>::FAMILY_ID;
 
     uint8_t tmp = bytes[HllUtil<>::MODE_BYTE];
     bytes[HllUtil<>::MODE_BYTE] = 0x10; // HLL_6, LIST
     CPPUNIT_ASSERT_THROW_MESSAGE("Failed to detect error in mode byte",
-                                 HllSketch<>::deserialize(bytes, sketchBytes.second),
+                                 hll_sketch::deserialize(bytes, sketchBytes.second),
                                  std::invalid_argument);
     bytes[HllUtil<>::MODE_BYTE] = tmp;
 
     tmp = bytes[HllUtil<>::LG_ARR_BYTE];
     bytes[HllUtil<>::LG_ARR_BYTE] = 0;
-    HllSketch<>::deserialize(bytes, sketchBytes.second);
+    hll_sketch::deserialize(bytes, sketchBytes.second);
     // should work fine despite the corruption
     bytes[HllUtil<>::LG_ARR_BYTE] = tmp;
 
     CPPUNIT_ASSERT_THROW_MESSAGE("Failed to detect error in serialized length",
-                                 HllSketch<>::deserialize(bytes, sketchBytes.second - 1),
+                                 hll_sketch::deserialize(bytes, sketchBytes.second - 1),
                                  std::invalid_argument);
     CPPUNIT_ASSERT_THROW_MESSAGE("Failed to detect error in serialized length",
-                                 HllSketch<>::deserialize(bytes, 3),
+                                 hll_sketch::deserialize(bytes, 3),
                                  std::invalid_argument);
     }
 
@@ -179,7 +176,7 @@ class HllArrayTest : public CppUnit::TestFixture {
     ss.put(0);
     ss.seekg(0);
     CPPUNIT_ASSERT_THROW_MESSAGE("Failed to detect error in preInts byte",
-                                 HllSketch<>::deserialize(ss),
+                                 hll_sketch::deserialize(ss),
                                  std::invalid_argument);
     CPPUNIT_ASSERT_THROW_MESSAGE("Failed to detect error in preInts byte",
                                  HllArray<>::newHll(ss),
@@ -191,7 +188,7 @@ class HllArrayTest : public CppUnit::TestFixture {
     ss.put(0);
     ss.seekg(0);
     CPPUNIT_ASSERT_THROW_MESSAGE("Failed to detect error in serialization version byte",
-                                 HllSketch<>::deserialize(ss),
+                                 hll_sketch::deserialize(ss),
                                  std::invalid_argument);
     ss.seekp(HllUtil<>::SER_VER_BYTE);
     ss.put(HllUtil<>::SER_VER);
@@ -200,7 +197,7 @@ class HllArrayTest : public CppUnit::TestFixture {
     ss.put(0);
     ss.seekg(0);
     CPPUNIT_ASSERT_THROW_MESSAGE("Failed to detect error in family id byte",
-                                 HllSketch<>::deserialize(ss),
+                                 hll_sketch::deserialize(ss),
                                  std::invalid_argument);
     ss.seekp(HllUtil<>::FAMILY_BYTE);
     ss.put(HllUtil<>::FAMILY_ID);
@@ -211,7 +208,7 @@ class HllArrayTest : public CppUnit::TestFixture {
     ss.put(0x11); // HLL_6, SET
     ss.seekg(0);
     CPPUNIT_ASSERT_THROW_MESSAGE("Failed to detect error in mode byte",
-                                 HllSketch<>::deserialize(ss),
+                                 hll_sketch::deserialize(ss),
                                  std::invalid_argument);
     ss.seekp(HllUtil<>::MODE_BYTE);
     ss.put(tmp);
@@ -221,7 +218,7 @@ class HllArrayTest : public CppUnit::TestFixture {
     ss.seekp(HllUtil<>::LG_ARR_BYTE);
     ss.put(0);
     ss.seekg(0);
-    HllSketch<>::deserialize(ss);
+    hll_sketch::deserialize(ss);
     // should work fine despite the corruption
     ss.seekp(HllUtil<>::LG_ARR_BYTE);
     ss.put(tmp);
diff --git a/hll/test/HllSketchTest.cpp b/hll/test/HllSketchTest.cpp
index d5ad78e..828989d 100644
--- a/hll/test/HllSketchTest.cpp
+++ b/hll/test/HllSketchTest.cpp
@@ -18,10 +18,6 @@
  */
 
 #include "hll.hpp"
-//#include "HllSketch.hpp"
-//#include "CouponList.hpp"
-//#include "CouponHashSet.hpp"
-//#include "HllArray.hpp"
 
 #include <cppunit/TestFixture.h>
 #include <cppunit/extensions/HelperMacros.h>
@@ -43,8 +39,6 @@ class hllSketchTest : public CppUnit::TestFixture {
   CPPUNIT_TEST(checkInputTypes);
   CPPUNIT_TEST_SUITE_END();
 
-  typedef HllSketch<> hll_sketch;
-
   void checkCopies() {
     runCheckCopy(14, HLL_4);
     runCheckCopy(8, HLL_6);
@@ -59,7 +53,7 @@ class hllSketchTest : public CppUnit::TestFixture {
     }
     //CPPUNIT_ASSERT_EQUAL(sk.getCurrentMode(), CurMode::LIST);
 
-    hll_sketch skCopy = sk.copy();
+    hll_sketch skCopy = sk;
     //CPPUNIT_ASSERT_EQUAL(skCopyPvt.getCurrentMode(), CurMode::LIST);
     CPPUNIT_ASSERT_DOUBLES_EQUAL(skCopy.getEstimate(), sk.getEstimate(), 0.0);
 
@@ -72,7 +66,7 @@ class hllSketchTest : public CppUnit::TestFixture {
     //CPPUNIT_ASSERT(sk.getCurrentMode() != skCopyPvt.getCurrentMode());
     CPPUNIT_ASSERT(16.0 < (sk.getEstimate() - skCopy.getEstimate()));
 
-    skCopy = sk.copy();
+    skCopy = sk;
     CPPUNIT_ASSERT_DOUBLES_EQUAL(skCopy.getEstimate(), sk.getEstimate(), 0.0);
 
     int u = (sk.getTgtHllType() == HLL_4) ? 100000 : 25;
@@ -83,7 +77,7 @@ class hllSketchTest : public CppUnit::TestFixture {
     //CPPUNIT_ASSERT(sk.getCurrentMode() != skCopyPvt.getCurrentMode());
     CPPUNIT_ASSERT(sk.getEstimate() != skCopy.getEstimate()); // either 1 or 100k difference
 
-    skCopy = sk.copy();
+    skCopy = sk;
     //CPPUNIT_ASSERT_EQUAL(skCopyPvt.getCurrentMode(), CurMode::HLL);
     CPPUNIT_ASSERT_DOUBLES_EQUAL(skCopy.getEstimate(), sk.getEstimate(), 0.0);
 
@@ -160,7 +154,7 @@ class hllSketchTest : public CppUnit::TestFixture {
 
     const int hllBytes = HllUtil<>::HLL_BYTE_ARR_START + (1 << lgConfigK);
     CPPUNIT_ASSERT_EQUAL(hllBytes, sk.getCompactSerializationBytes());
-    CPPUNIT_ASSERT_EQUAL(hllBytes, HllSketch<>::getMaxUpdatableSerializationBytes(lgConfigK, HLL_8));
+    CPPUNIT_ASSERT_EQUAL(hllBytes, hll_sketch::getMaxUpdatableSerializationBytes(lgConfigK, HLL_8));
   }
 
   void checkNumStdDev() {
@@ -232,7 +226,7 @@ class hllSketchTest : public CppUnit::TestFixture {
     sk.to_string(oss, false, true, true, false);
 
     // need to delete old sketch?
-    sk = HllSketch<>(8, HLL_8);
+    sk = hll_sketch(8, HLL_8);
     for (int i = 0; i < 25; ++i) { sk.update(i); }
     sk.to_string(oss, false, true, true, true);
   }
@@ -242,7 +236,7 @@ class hllSketchTest : public CppUnit::TestFixture {
   void checkEmptyCoupon() {
     int lgK = 8;
     TgtHllType type = HLL_8;
-    hll_sketch sk = HllSketch<>(lgK, type);
+    hll_sketch sk = hll_sketch(lgK, type);
     for (int i = 0; i < 20; ++i) { sk.update(i); } // SET mode
     static_cast<HllSketchPvt*>(sk.get()).couponUpdate(0);
     CPPUNIT_ASSERT_DOUBLES_EQUAL(20, sk.getEstimate(), 0.001);
@@ -292,7 +286,7 @@ class hllSketchTest : public CppUnit::TestFixture {
       CPPUNIT_ASSERT_EQUAL(sk.getUpdatableSerializationBytes(), (int) ss.tellp());
     }
     
-    hll_sketch sk2 = HllSketch<>::deserialize(ss);
+    hll_sketch sk2 = hll_sketch::deserialize(ss);
     CPPUNIT_ASSERT_DOUBLES_EQUAL(n, sk2.getEstimate(), 0.01);
     bool isCompact = sk2.isCompact();
 
@@ -303,11 +297,11 @@ class hllSketchTest : public CppUnit::TestFixture {
     hll_sketch sketch1(HllUtil<>::MIN_LOG_K, TgtHllType::HLL_8);
     hll_sketch sketch2(HllUtil<>::MAX_LOG_K, TgtHllType::HLL_4);
     CPPUNIT_ASSERT_THROW_MESSAGE("Failed to throw with lgK too small",
-                                 HllSketch<>(HllUtil<>::MIN_LOG_K - 1),
+                                 hll_sketch(HllUtil<>::MIN_LOG_K - 1),
                                  std::invalid_argument);
 
     CPPUNIT_ASSERT_THROW_MESSAGE("Failed to throw with lgK too large",
-                                 HllSketch<>(HllUtil<>::MAX_LOG_K + 1),
+                                 hll_sketch(HllUtil<>::MAX_LOG_K + 1),
                                  std::invalid_argument);
   }
 
@@ -338,19 +332,19 @@ class hllSketchTest : public CppUnit::TestFixture {
     sk.update(str.c_str(), str.length());
     CPPUNIT_ASSERT_DOUBLES_EQUAL(4.0, sk.getEstimate(), 0.01);
 
-    sk = HllSketch<>(8, TgtHllType::HLL_6);
+    sk = hll_sketch(8, TgtHllType::HLL_6);
     sk.update((float) 0.0);
     sk.update((float) -0.0);
     sk.update((double) 0.0);
     sk.update((double) -0.0);
     CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, sk.getEstimate(), 0.01);
 
-    sk = HllSketch<>(8, TgtHllType::HLL_4);
+    sk = hll_sketch(8, TgtHllType::HLL_4);
     sk.update(std::nanf("3"));
     sk.update(std::nan("9"));
     CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, sk.getEstimate(), 0.01);
 
-    sk = HllSketch<>(8, TgtHllType::HLL_4);
+    sk = hll_sketch(8, TgtHllType::HLL_4);
     sk.update(nullptr, 0);
     sk.update("");
     CPPUNIT_ASSERT(sk.isEmpty());
diff --git a/hll/test/HllUnionTest.cpp b/hll/test/HllUnionTest.cpp
index 8aba01d..b5d0c40 100644
--- a/hll/test/HllUnionTest.cpp
+++ b/hll/test/HllUnionTest.cpp
@@ -41,9 +41,6 @@ class HllUnionTest : public CppUnit::TestFixture {
   CPPUNIT_TEST(checkInputTypes);
   CPPUNIT_TEST_SUITE_END();
 
-  typedef HllSketch<> hll_sketch;
-  typedef HllUnion<> hll_union;
-
   int min(int a, int b) {
     return (a < b) ? a : b;
   }
@@ -208,8 +205,8 @@ class HllUnionTest : public CppUnit::TestFixture {
   void checkUnionEquality(hll_union& u1, hll_union& u2) {
     //HllSketchPvt* sk1 = static_cast<HllSketchPvt*>(static_cast<HllUnionPvt*>(u1.get())->gadget.get());
     //HllSketchPvt* sk2 = static_cast<HllSketchPvt*>(static_cast<HllUnionPvt*>(u2.get())->gadget.get());
-    HllSketch<> sk1 = u1.getResult();
-    HllSketch<> sk2 = u2.getResult();
+    hll_sketch sk1 = u1.getResult();
+    hll_sketch sk2 = u2.getResult();
 
     CPPUNIT_ASSERT_EQUAL(sk1.getLgConfigK(), sk2.getLgConfigK());
     CPPUNIT_ASSERT_DOUBLES_EQUAL(sk1.getLowerBound(1), sk2.getLowerBound(1), 0.0);
diff --git a/hll/test/ToFromByteArrayTest.cpp b/hll/test/ToFromByteArrayTest.cpp
index 766039e..594fc2f 100644
--- a/hll/test/ToFromByteArrayTest.cpp
+++ b/hll/test/ToFromByteArrayTest.cpp
@@ -38,8 +38,6 @@ class ToFromByteArrayTest : public CppUnit::TestFixture {
   //CPPUNIT_TEST(doubleSerialize);
   CPPUNIT_TEST_SUITE_END();
 
-  typedef HllSketch<> hll_sketch;
-
   void doubleSerialize() {
     hll_sketch sk(9, HLL_8);
     for (int i = 0; i < 1024; ++i) {
@@ -55,7 +53,7 @@ class ToFromByteArrayTest : public CppUnit::TestFixture {
     std::string str = ss.str();
 
 
-    hll_sketch sk2 = HllSketch<>::deserialize(ser1.first.get(), ser1.second);
+    hll_sketch sk2 = hll_sketch::deserialize(ser1.first.get(), ser1.second);
     //hll_sketch sk2 = HllSketch::deserialize(ss1);
     
     //std::stringstream ss2;
@@ -74,7 +72,7 @@ class ToFromByteArrayTest : public CppUnit::TestFixture {
 
     for (int i = 0; i < len; ++i) {
       if (b1[i] != b2[i]) {
-        hll_sketch from_ss = HllSketch<>::deserialize(ss1);
+        hll_sketch from_ss = hll_sketch::deserialize(ss1);
         std::cout << "ser3:\n";
         std::pair<byte_ptr_with_deleter, size_t> ser3 = from_ss.serializeUpdatable();
         uint8_t* b3 = ser3.first.get();
@@ -101,7 +99,7 @@ class ToFromByteArrayTest : public CppUnit::TestFixture {
 
     std::ifstream ifs;
     ifs.open(inputPath + "list_from_java.bin", std::ios::binary);
-    hll_sketch sk = HllSketch<>::deserialize(ifs);
+    hll_sketch sk = hll_sketch::deserialize(ifs);
     CPPUNIT_ASSERT(sk.isEmpty() == false);
     CPPUNIT_ASSERT_EQUAL(sk.getLgConfigK(), 8);
     CPPUNIT_ASSERT_DOUBLES_EQUAL(sk.getLowerBound(1), 7.0, 0.0);
@@ -117,7 +115,7 @@ class ToFromByteArrayTest : public CppUnit::TestFixture {
     ifs.close();
 
     ifs.open(inputPath + "compact_set_from_java.bin", std::ios::binary);
-    sk = HllSketch<>::deserialize(ifs);
+    sk = hll_sketch::deserialize(ifs);
     CPPUNIT_ASSERT(sk.isEmpty() == false);
     CPPUNIT_ASSERT_EQUAL(sk.getLgConfigK(), 8);
     CPPUNIT_ASSERT_DOUBLES_EQUAL(sk.getLowerBound(1), 24.0, 0.0);
@@ -133,7 +131,7 @@ class ToFromByteArrayTest : public CppUnit::TestFixture {
     ifs.close();
 
     ifs.open(inputPath + "updatable_set_from_java.bin", std::ios::binary);
-    sk = HllSketch<>::deserialize(ifs);
+    sk = hll_sketch::deserialize(ifs);
     CPPUNIT_ASSERT(sk.isEmpty() == false);
     CPPUNIT_ASSERT_EQUAL(sk.getLgConfigK(), 8);
     CPPUNIT_ASSERT_DOUBLES_EQUAL(sk.getLowerBound(1), 24.0, 0.0);
@@ -150,7 +148,7 @@ class ToFromByteArrayTest : public CppUnit::TestFixture {
 
 
     ifs.open(inputPath + "array6_from_java.bin", std::ios::binary);
-    sk = HllSketch<>::deserialize(ifs);
+    sk = hll_sketch::deserialize(ifs);
     CPPUNIT_ASSERT(sk.isEmpty() == false);
     CPPUNIT_ASSERT_EQUAL(sk.getLgConfigK(), 8);
     CPPUNIT_ASSERT_DOUBLES_EQUAL(sk.getLowerBound(1), 9589.968564, 1e-5); // java: 9589.968564432073
@@ -171,7 +169,7 @@ class ToFromByteArrayTest : public CppUnit::TestFixture {
 
 
     ifs.open(inputPath + "compact_array4_from_java.bin", std::ios::binary);
-    sk = HllSketch<>::deserialize(ifs);
+    sk = hll_sketch::deserialize(ifs);
     CPPUNIT_ASSERT(sk.isEmpty() == false);
     CPPUNIT_ASSERT_EQUAL(sk.getLgConfigK(), 8);
     CPPUNIT_ASSERT_DOUBLES_EQUAL(sk.getLowerBound(1), 9589.968564, 1e-5); // java: 9589.968564432073
@@ -192,7 +190,7 @@ class ToFromByteArrayTest : public CppUnit::TestFixture {
 
 
     ifs.open(inputPath + "updatable_array4_from_java.bin", std::ios::binary);
-    sk = HllSketch<>::deserialize(ifs);
+    sk = hll_sketch::deserialize(ifs);
     CPPUNIT_ASSERT(sk.isEmpty() == false);
     CPPUNIT_ASSERT_EQUAL(sk.getLgConfigK(), 8);
     CPPUNIT_ASSERT_DOUBLES_EQUAL(sk.getLowerBound(1), 9589.968564, 1e-5); // java: 9589.968564432073
@@ -220,20 +218,20 @@ class ToFromByteArrayTest : public CppUnit::TestFixture {
 
     std::stringstream ss(std::ios::in | std::ios::out | std::ios::binary);
     src.serializeCompact(ss);
-    hll_sketch dst = HllSketch<>::deserialize(ss);
+    hll_sketch dst = hll_sketch::deserialize(ss);
     checkSketchEquality(src, dst);
 
     std::pair<byte_ptr_with_deleter, const size_t> bytes1 = src.serializeCompact();
-    dst = HllSketch<>::deserialize(bytes1.first.get(), bytes1.second);
+    dst = hll_sketch::deserialize(bytes1.first.get(), bytes1.second);
     checkSketchEquality(src, dst);
 
     ss.clear();
     src.serializeUpdatable(ss);
-    dst = HllSketch<>::deserialize(ss);
+    dst = hll_sketch::deserialize(ss);
     checkSketchEquality(src, dst);
 
     std::pair<byte_ptr_with_deleter, const size_t> bytes2 = src.serializeUpdatable();
-    dst = HllSketch<>::deserialize(bytes2.first.get(), bytes2.second);
+    dst = hll_sketch::deserialize(bytes2.first.get(), bytes2.second);
     checkSketchEquality(src, dst);
   }
 


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