emhash icon indicating copy to clipboard operation
emhash copied to clipboard

Default load factor ODR issue

Open MetalOxideSemi opened this issue 1 year ago • 3 comments

#include <emhash/hash_set8.hpp>
#include <emhash/hash_table8.hpp>

These headers share the same definition of emhash8::EMH_DEFAULT_LOAD_FACTOR emhash8::EMH_MIN_LOAD_FACTOR which causes a source file which includes both these headers failing to compile.

In included file: redefinition of 'EMH_DEFAULT_LOAD_FACTOR'

MetalOxideSemi avatar Aug 27 '24 09:08 MetalOxideSemi

Perhaps it's a little more flexible solution to configure them as template parameters, like

struct DefaultPolicy {
  static constexpr float load_factor = 0.80f;
  static constexpr size_t cacheline_size = 64U;
};
template <typename K, typname V, typename H, typename E, typename Alloc, typename Policy = DefaultPolicy>
struct ...

MetalOxideSemi avatar Aug 27 '24 09:08 MetalOxideSemi

u are right, maybe I need remove some marcos.

ktprime avatar Aug 27 '24 09:08 ktprime

I have fix some compile issue, thanks for report

ktprime avatar Aug 27 '24 11:08 ktprime