Change all systypes from map to set
Systypes are never directly looked up by name, so this change avoids conflicting systypes from overwriting each other.
This commit is contained in:
parent
5ac3749677
commit
98886e8143
2 changed files with 11 additions and 4 deletions
|
@ -195,6 +195,7 @@ struct core_type
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
core_type(core_type_params& params);
|
core_type(core_type_params& params);
|
||||||
|
~core_type() throw();
|
||||||
static std::list<core_type*> get_core_types();
|
static std::list<core_type*> get_core_types();
|
||||||
core_region& get_preferred_region();
|
core_region& get_preferred_region();
|
||||||
std::list<core_region*> get_regions();
|
std::list<core_region*> get_regions();
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "interface/callbacks.hpp"
|
#include "interface/callbacks.hpp"
|
||||||
#include "library/minmax.hpp"
|
#include "library/minmax.hpp"
|
||||||
#include "library/string.hpp"
|
#include "library/string.hpp"
|
||||||
|
#include <set>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
@ -27,9 +28,9 @@ namespace
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<std::string, core_type*>& types()
|
std::set<core_type*>& types()
|
||||||
{
|
{
|
||||||
static std::map<std::string, core_type*> x;
|
static std::set<core_type*> x;
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,7 +156,12 @@ core_type::core_type(core_type_params& params)
|
||||||
extensions.push_back(ext);
|
extensions.push_back(ext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
types()[iname] = this;
|
types().insert(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
core_type::~core_type() throw()
|
||||||
|
{
|
||||||
|
types().erase(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned core_type::get_id()
|
unsigned core_type::get_id()
|
||||||
|
@ -194,7 +200,7 @@ std::list<core_type*> core_type::get_core_types()
|
||||||
{
|
{
|
||||||
std::list<core_type*> ret;
|
std::list<core_type*> ret;
|
||||||
for(auto i : types())
|
for(auto i : types())
|
||||||
ret.push_back(i.second);
|
ret.push_back(i);
|
||||||
ret.sort(compare_coretype);
|
ret.sort(compare_coretype);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue