Skip to content

Commit

Permalink
Update cpc_compressor_impl.hpp
Browse files Browse the repository at this point in the history
cleaner solution with no extra bool and check
  • Loading branch information
jmalkin authored Dec 21, 2023
1 parent 59bc5fb commit 7991dbd
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions cpc/include/cpc_compressor_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,8 @@ namespace datasketches {
// construct on first use
template<typename A>
cpc_compressor<A>& get_compressor() {
static bool do_init = true;
static cpc_compressor<A>* instance = new cpc_compressor<A>(); // use new for global initialization
if (do_init) {
std::atexit(destroy_compressor<A>); // just to clean up a little more nicely; don't worry if it fails
do_init = false;
}
static int req_result = std::atexit(destroy_compressor<A>); // just to clean up a little more nicely; don't worry if it fails
return *instance;
}

Expand Down

0 comments on commit 7991dbd

Please sign in to comment.