<commit_before>
// InstrusiveBase.h

#ifndef INTRUSIVE_BASE_H
#define INTRUSIVE_BASE_H

#include <boost/intrusive_ptr.hpp>
#include <boost/assert.hpp>
#include "Logger.h"

template <class Derived>
class IntrusiveBase {
  friend void intrusive_ptr_add_ref(const Derived* p) {
    BOOST_ASSERT(p);
    ++((const IntrusiveBase*) p)->counter_;
    
    MLOG(LEV_DEBUG5) << "Object " << p << " ref_count=" << ((const IntrusiveBase*) p)->counter_;
  }

  friend void intrusive_ptr_release(const Derived* p) {
    BOOST_ASSERT(p);
    MLOG(LEV_DEBUG5) << "Object " << p << " ref_count=" << ((const IntrusiveBase*) p)->counter_ - 1;
    if (--((const IntrusiveBase*) p)->counter_ == 0) {
      delete p;
    }
  }

  protected:
    IntrusiveBase(): counter_(0) {}
    ~IntrusiveBase() { }

    IntrusiveBase(const IntrusiveBase&) : counter_(0) {}
    IntrusiveBase& operator=(const IntrusiveBase&) { return *this; }

  private:
    mutable unsigned long counter_;
};

#endif
<commit_msg>fixes #56. I removed the logging from IntrusiveBase class.  I think there was some funky interplay between the templating, boost library, and logging.  I'm not sure of the exact cause, but the logging in IntrusiveBase is not really necessary anymore.<commit_after>
// InstrusiveBase.h

#ifndef INTRUSIVE_BASE_H
#define INTRUSIVE_BASE_H

#include <boost/intrusive_ptr.hpp>
#include <boost/assert.hpp>
#include "Logger.h"

template <class Derived>
class IntrusiveBase {
  friend void intrusive_ptr_add_ref(const Derived* p) {
    BOOST_ASSERT(p);
    ++((const IntrusiveBase*) p)->counter_;
  }

  friend void intrusive_ptr_release(const Derived* p) {
    BOOST_ASSERT(p);
    if (--((const IntrusiveBase*) p)->counter_ == 0) {
      delete p;
    }
  }

  protected:
    IntrusiveBase(): counter_(0) {}
    ~IntrusiveBase() { }

    IntrusiveBase(const IntrusiveBase&) : counter_(0) {}
    IntrusiveBase& operator=(const IntrusiveBase&) { return *this; }

  private:
    mutable unsigned long counter_;
};

#endif

{'fraction_non_alphanumeric': 0.13052208835341367, 'fraction_numerical': 0.005522088353413655, 'mean_word_length': 4.058375634517766, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5789499', 'n_tokens_mistral': 702, 'n_tokens_neox': 660, 'n_words': 168}