@@ -305,7 +305,7 @@ namespace ADT {
305305 std::unique_ptr<IterateInfo> Info;
306306 std::unique_ptr<StackInfo> NextStack;
307307
308- TrieParser & Parser;
308+ TrieParser * Parser;
309309
310310 void SetupInfoForNewStack () noexcept {
311311 this ->Info ->stringRef ().append (NextStack->node ().prefix ());
@@ -465,11 +465,11 @@ namespace ADT {
465465
466466 // Prepare the next-stack before returning.
467467 const auto Error =
468- Parser. ParseNextNode (this ->Begin ,
469- Ptr,
470- this ->End ,
471- this ->Info ->rangeListRef (),
472- &this ->NextStack ->node ());
468+ Parser-> ParseNextNode (this ->Begin ,
469+ Ptr,
470+ this ->End ,
471+ this ->Info ->rangeListRef (),
472+ &this ->NextStack ->node ());
473473
474474 UpdateOffset ();
475475 if (Error != Error::None) {
@@ -496,6 +496,11 @@ namespace ADT {
496496 return Error::None;
497497 }
498498 public:
499+ using difference_type = std::ptrdiff_t ;
500+ using value_type = IterateInfo;
501+
502+ explicit Iterator () noexcept = default;
503+
499504 explicit
500505 Iterator (uint8_t *const Begin,
501506 uint8_t *const End,
@@ -504,7 +509,7 @@ namespace ADT {
504509 const ParseOptions &Options = ParseOptions()) noexcept
505510 : Begin(Begin), End(End),
506511 Info (std::make_unique<IterateInfo>(ExportInfoParser)),
507- Parser(Parser)
512+ Parser(& Parser)
508513 {
509514 Info->setMaxDepth (Options.MaxDepth );
510515
@@ -594,6 +599,34 @@ namespace ADT {
594599 return this ->Info .get ();
595600 }
596601
602+ [[nodiscard]] constexpr
603+ auto operator <=>(const Iterator &Other) const noexcept = default ;
604+
605+ [[nodiscard]]
606+ inline auto operator ==(const Iterator &Other) const noexcept {
607+ if (this ->Begin != Other.Begin && this ->End != Other.End ) {
608+ return false ;
609+ }
610+
611+ if (this ->Info .StackList .empty ()) {
612+ if (Other.Info .StackList .empty ()) {
613+ return true ;
614+ } else {
615+ return false ;
616+ }
617+ } else if (Other.Info .StackList .empty ()) {
618+ return false ;
619+ }
620+
621+ const auto &Stack = this ->Info .StackList .back ();
622+ const auto &OtherStack = Other.Info .StackList .back ();
623+
624+ const auto &Node = Stack.node ();
625+ const auto &OtherNode = OtherStack.node ();
626+
627+ return Node.offset () == OtherNode.offset ();
628+ }
629+
597630 [[nodiscard]]
598631 inline auto operator ==(const IteratorEnd &) const noexcept {
599632 return this ->isAtEnd ();
@@ -629,6 +662,11 @@ namespace ADT {
629662 return *this ;
630663 }
631664 public:
665+ using difference_type = std::ptrdiff_t ;
666+ using value_type = IterateInfo;
667+
668+ ExportIterator () noexcept = default ;
669+
632670 explicit
633671 ExportIterator (
634672 uint8_t *Begin,
@@ -647,7 +685,7 @@ namespace ADT {
647685
648686 explicit
649687 ExportIterator (
650- const ADT::MemoryMap & Map,
688+ const ADT::MemoryMap Map,
651689 TrieParser &TrieParser,
652690 T &ExportInfoParser,
653691 const ParseOptions &Options = ParseOptions()) noexcept
@@ -660,6 +698,10 @@ namespace ADT {
660698 }
661699 }
662700
701+ inline ExportIterator (const ExportIterator &Other) noexcept {
702+ this ->Iter = Other.Iter ;
703+ }
704+
663705 [[nodiscard]] inline auto &info () noexcept {
664706 return this ->Iter .info ();
665707 }
@@ -703,7 +745,7 @@ namespace ADT {
703745 return this ->Iter .info ();
704746 }
705747
706- [[nodiscard]] inline const auto &operator *() const noexcept {
748+ [[nodiscard]] inline auto &operator *() const noexcept {
707749 return this ->Iter .info ();
708750 }
709751
@@ -715,6 +757,21 @@ namespace ADT {
715757 return &this ->Iter .info ();
716758 }
717759
760+ inline auto operator =(const ExportIterator &Other) noexcept
761+ -> decltype (*this )
762+ {
763+ this ->Iter = Other.Iter ;
764+ return *this ;
765+ }
766+
767+ [[nodiscard]] constexpr auto
768+ operator <=>(const ExportIterator &Other) const noexcept = default ;
769+
770+ [[nodiscard]]
771+ inline auto operator ==(const Iterator &Other) const noexcept {
772+ return this ->Iter == Other.Iter ;
773+ }
774+
718775 [[nodiscard]]
719776 inline auto operator ==(const IteratorEnd &End) const noexcept {
720777 return this ->Iter == End;
@@ -741,7 +798,7 @@ namespace ADT {
741798 ExportInfoParser (ExportInfoParser) {};
742799
743800 constexpr explicit
744- Trie (const ADT::MemoryMap & Map,
801+ Trie (const ADT::MemoryMap Map,
745802 TrieParser &TrieParser,
746803 T &ExportInfoParser) noexcept
747804 : Begin(Map.base<uint8_t >()),
@@ -803,7 +860,7 @@ namespace ADT {
803860 ExportInfoParser (ExportInfoParser) {}
804861
805862 explicit
806- ExportMap (const ADT::MemoryMap & Map,
863+ ExportMap (const ADT::MemoryMap Map,
807864 TrieParser &Parser,
808865 T &ExportInfoParser) noexcept
809866 : Begin(Map.base<uint8_t >()),
0 commit comments