File tree Expand file tree Collapse file tree 2 files changed +10
-14
lines changed
src/ArduinoJson/Collection Expand file tree Collapse file tree 2 files changed +10
-14
lines changed Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ inline void VariantImpl::removeOne(iterator it) {
7474 coll->head = next;
7575 if (next == NULL_SLOT)
7676 coll->tail = prev.id ();
77- freeVariant ({it->data (), it.currentId_ });
77+ freeVariant ({it->data (), it.slotId () });
7878}
7979
8080inline void VariantImpl::removePair (VariantImpl::iterator it) {
Original file line number Diff line number Diff line change 88#include < ArduinoJson/Polyfills/assert.hpp>
99#include < ArduinoJson/Variant/VariantImpl.hpp>
1010
11- #include < stddef.h> // size_t
12-
1311ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE
1412
15- struct VariantData ;
16- class ResourceManager ;
17- class VariantImpl ;
18-
1913class CollectionIterator {
20- friend class VariantImpl ;
21-
2214 public:
2315 CollectionIterator () {}
2416
17+ CollectionIterator (SlotId slotId, ResourceManager* resources)
18+ : value_(resources->getVariant (slotId), resources), slotId_(slotId) {}
19+
2520 void next () {
2621 ARDUINOJSON_ASSERT (!done ());
2722 auto nextId = value_.data ()->next ;
2823 auto resources = value_.resources ();
2924 value_ = VariantImpl (resources->getVariant (nextId), resources);
30- currentId_ = nextId;
25+ slotId_ = nextId;
3126 }
3227
3328 const VariantImpl& operator *() const {
@@ -50,12 +45,13 @@ class CollectionIterator {
5045 return !operator ==(other);
5146 }
5247
53- private:
54- CollectionIterator (SlotId slotId, ResourceManager* resources)
55- : value_(resources-> getVariant (slotId), resources), currentId_(slotId) { }
48+ SlotId slotId () const {
49+ return slotId_;
50+ }
5651
52+ private:
5753 VariantImpl value_;
58- SlotId currentId_ = NULL_SLOT;
54+ SlotId slotId_ = NULL_SLOT;
5955};
6056
6157ARDUINOJSON_END_PRIVATE_NAMESPACE
You can’t perform that action at this time.
0 commit comments