replace unordered_map with map, less heap

This commit is contained in:
proddy
2026-01-22 16:40:05 +01:00
parent 038f06e59f
commit e0a26a38fa
7 changed files with 14 additions and 14 deletions

View File

@@ -20,7 +20,7 @@
#define EMSESP_EMSFACTORY_H_
#include <memory> // for unique_ptr
#include <unordered_map>
#include <map>
// Forward declaration
namespace emsesp {
@@ -45,7 +45,7 @@ class EMSFactory {
reg[device_type] = factory;
}
using FactoryMap = std::unordered_map<uint8_t, EMSFactory *>;
using FactoryMap = std::map<uint8_t, EMSFactory *>;
// returns all registered classes (really only for debugging)
static auto device_handlers() -> const FactoryMap & {
@@ -76,7 +76,7 @@ class EMSFactory {
static auto makeRaw(const uint8_t device_type, uint8_t device_id, uint8_t product_id, const char * version, const char * name, uint8_t flags, uint8_t brand)
-> EMSdevice * {
auto & reg = EMSFactory::getRegister();
auto it = reg.find(device_type);
auto it = reg.find(device_type);
if (it != reg.end()) {
return it->second->construct(device_type, device_id, product_id, version, name, flags, brand);
}