Tessil / hat-trie

C++ implementation of a fast and memory efficient HAT-trie
MIT License
795 stars 114 forks source link

boolean value is not supported #36

Open vigsterkr opened 3 years ago

vigsterkr commented 3 years ago

when creating a tsl::htrie_map<char, bool> and trying to insert or emplace an element i'm getting the following error:

array_hash.h:870:14: error: non-const lvalue reference to type 'bool' cannot bind to a temporary of type
      'std::__1::vector<bool, std::__1::allocator<bool> >::reference' (aka '__bit_reference<std::__1::vector<bool, std::__1::allocator<bool> > >')
      return this->m_array_hash->m_values[value_position()];
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

probably this is due to the difference of implementation of a bitvector, see std::vector<bool>

Tessil commented 3 years ago

Sorry for the late reply.

It's effectively due to the usage of std::vector<T> in the array-hash project. I have to check if I could swap it with a std::deque<T>. I mainly used std::vector<T> to be able to use reserve so that I can then safely move noexcept values without triggering a potential exception.