Closed huster-songtao closed 5 months ago
old version
V& operator[](const K& key) { MapNode** pp = &head; while (*pp != nullptr && (*pp)->key != key) { pp = &(*pp)->next; } if (*pp != nullptr) { return (*pp)->value; } else { MapNode* newNode = new MapNode{ key, V(), nullptr }; *pp = newNode; return newNode->value; } }
// Insert a key-value pair into the pin map pinMap["D0"] = D0; pinMap["D1"] = D1; pinMap["D2"] = D2; pinMap["D3"] = D3; pinMap["D4"] = D4; pinMap["D5"] = D5; pinMap["D6"] = D6; pinMap["D7"] = D7; pinMap["D8"] = D8; pinMap["D9"] = D9; pinMap["D10"] = D10;
Serial.print("pinMap.size() = "); Serial.println(pinMap.size());
The Count is 0. and then Map.h modified below:
V& operator[](const K& key) { MapNode** pp = &head; while (*pp != nullptr && (*pp)->key != key) { pp = &(*pp)->next; } if (*pp != nullptr) { return (*pp)->value; } else { MapNode* newNode = new MapNode{ key, V(), nullptr }; *pp = newNode; Count++; return newNode->value; } }
Count++; will fixed the bug.
Issue has now been Patched in latest Platformio Version. Arduino Version to follow. Changes can be found under Development Branch of this Repository. Thank you for informing me of the issue.
old version
// Insert a key-value pair into the pin map pinMap["D0"] = D0; pinMap["D1"] = D1; pinMap["D2"] = D2; pinMap["D3"] = D3; pinMap["D4"] = D4; pinMap["D5"] = D5; pinMap["D6"] = D6; pinMap["D7"] = D7; pinMap["D8"] = D8; pinMap["D9"] = D9; pinMap["D10"] = D10;
Serial.print("pinMap.size() = "); Serial.println(pinMap.size());
The Count is 0. and then Map.h modified below:
Count++; will fixed the bug.