summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
f19366d)
Otherwise declaring tag constants as static members of classes is
unreliable because of the undefined initialization order of globals
in different translation units.
-map<Msp::GL::Tag, string> tag_names;
+map<Msp::GL::Tag, string> &get_tag_names()
+{
+ static map<Msp::GL::Tag, string> names;
+ return names;
+}
- tag_names.insert(make_pair(*this, string(s)));
+ get_tag_names().insert(make_pair(*this, string(s)));
{
#ifdef DEBUG
if(!s.empty())
{
#ifdef DEBUG
if(!s.empty())
- tag_names.insert(make_pair(*this, s));
+ get_tag_names().insert(make_pair(*this, s));
#endif
}
string Tag::str() const
{
#ifdef DEBUG
#endif
}
string Tag::str() const
{
#ifdef DEBUG
- auto i=tag_names.find(*this);
- if(i!=tag_names.end())
+ const auto &names = get_tag_names();
+ auto i = names.find(*this);
+ if(i!=names.end())
return i->second;
#endif
return format("Tag(%d)", id);
return i->second;
#endif
return format("Tag(%d)", id);