Skip to content

Commit

Permalink
Fix compilation error with GCC 9, the implicit copy/move constructor/…
Browse files Browse the repository at this point in the history
…operator of the iterator were not generated.
  • Loading branch information
Tessil committed Feb 13, 2019
1 parent afcc269 commit c421543
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
8 changes: 7 additions & 1 deletion include/tsl/array-hash/array_hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -827,12 +827,18 @@ class array_hash: private value_container<T>, private Hash, private GrowthPolicy
array_hash_iterator() noexcept: m_array_hash(nullptr) {
}

array_hash_iterator(const array_hash_iterator<false>& other) noexcept :
template<bool TIsConst = IsConst, typename std::enable_if<TIsConst>::type* = nullptr>
array_hash_iterator(const array_hash_iterator<!TIsConst>& other) noexcept :
m_buckets_iterator(other.m_buckets_iterator),
m_array_bucket_iterator(other.m_array_bucket_iterator),
m_array_hash(other.m_array_hash)
{
}

array_hash_iterator(const array_hash_iterator& other) = default;
array_hash_iterator(array_hash_iterator&& other) = default;
array_hash_iterator& operator=(const array_hash_iterator& other) = default;
array_hash_iterator& operator=(array_hash_iterator&& other) = default;

const CharT* key() const {
return m_array_bucket_iterator.key();
Expand Down
19 changes: 14 additions & 5 deletions include/tsl/htrie_hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -577,24 +577,33 @@ class htrie_hash {
public:
htrie_hash_iterator() noexcept {
}

template<bool P = IsPrefixIterator, typename std::enable_if<!P>::type* = nullptr>
htrie_hash_iterator(const htrie_hash_iterator<false, false>& other) noexcept:

// Copy constructor from iterator to const_iterator.
template<bool TIsConst = IsConst, bool TIsPrefixIterator = IsPrefixIterator,
typename std::enable_if<TIsConst && !TIsPrefixIterator>::type* = nullptr>
htrie_hash_iterator(const htrie_hash_iterator<!TIsConst, TIsPrefixIterator>& other) noexcept:
m_current_trie_node(other.m_current_trie_node), m_current_hash_node(other.m_current_hash_node),
m_array_hash_iterator(other.m_array_hash_iterator),
m_array_hash_end_iterator(other.m_array_hash_end_iterator),
m_read_trie_node_value(other.m_read_trie_node_value)
{
}

template<bool P = IsPrefixIterator, typename std::enable_if<P>::type* = nullptr>
htrie_hash_iterator(const htrie_hash_iterator<false, true>& other) noexcept:
// Copy constructor from iterator to const_iterator.
template<bool TIsConst = IsConst, bool TIsPrefixIterator = IsPrefixIterator,
typename std::enable_if<TIsConst && TIsPrefixIterator>::type* = nullptr>
htrie_hash_iterator(const htrie_hash_iterator<!TIsConst, TIsPrefixIterator>& other) noexcept:
m_current_trie_node(other.m_current_trie_node), m_current_hash_node(other.m_current_hash_node),
m_array_hash_iterator(other.m_array_hash_iterator),
m_array_hash_end_iterator(other.m_array_hash_end_iterator),
m_read_trie_node_value(other.m_read_trie_node_value), m_prefix_filter(other.m_prefix_filter)
{
}

htrie_hash_iterator(const htrie_hash_iterator& other) = default;
htrie_hash_iterator(htrie_hash_iterator&& other) = default;
htrie_hash_iterator& operator=(const htrie_hash_iterator& other) = default;
htrie_hash_iterator& operator=(htrie_hash_iterator&& other) = default;

void key(std::basic_string<CharT>& key_buffer_out) const {
key_buffer_out.clear();
Expand Down

0 comments on commit c421543

Please sign in to comment.