Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions inflection/src/inflection/dictionary/DictionaryKeyIterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,22 @@ DictionaryKeyIterator::DictionaryKeyIterator(const metadata::MarisaTrieIterator<
}

DictionaryKeyIterator::DictionaryKeyIterator(DictionaryKeyIterator&& iterator)
: trieIterator(iterator.trieIterator)
: trieIterator(npc(iterator.trieIterator.release()))
{
iterator.trieIterator = nullptr;
}

DictionaryKeyIterator::~DictionaryKeyIterator()
{
delete trieIterator;
}

const ::std::u16string&
DictionaryKeyIterator::operator*() const {
return (*(*npc(trieIterator))).first;
return (*(*trieIterator)).first;
}

DictionaryKeyIterator&
DictionaryKeyIterator::operator++() {
++*npc(trieIterator);
++*trieIterator;
return *this;
}

Expand All @@ -52,13 +50,13 @@ DictionaryKeyIterator::operator!=(const DictionaryKeyIterator& rhs) const {
DictionaryKeyIterator
DictionaryKeyIterator::begin() const
{
return DictionaryKeyIterator(npc(trieIterator)->begin());
return DictionaryKeyIterator(trieIterator->begin());
}

DictionaryKeyIterator
DictionaryKeyIterator::end() const
{
return DictionaryKeyIterator(npc(trieIterator)->end());
return DictionaryKeyIterator(trieIterator->end());
}

} // namespace inflection::dictionary
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <inflection/dictionary/fwd.hpp>
#include <inflection/Object.hpp>
#include <cstdint>
#include <memory>
#include <string>

/**
Expand Down Expand Up @@ -62,7 +63,7 @@ class INFLECTION_CLASS_API inflection::dictionary::DictionaryKeyIterator

explicit DictionaryKeyIterator(const ::inflection::dictionary::metadata::MarisaTrieIterator<uint64_t>& trieIterator);

::inflection::dictionary::metadata::MarisaTrieIterator<uint64_t>* trieIterator { };
std::unique_ptr<::inflection::dictionary::metadata::MarisaTrieIterator<uint64_t>> trieIterator { };

friend class DictionaryMetaData_MMappedDictionary;
};
Loading