reftrack: remove inline operator[]

Use of class static member 'zero'
in an inline'd method is causing DLL confusion
in dependent modules.
This commit is contained in:
Michael Davidsaver
2017-11-02 10:06:36 -05:00
parent 21a03d2b85
commit a9f2d7df40
2 changed files with 9 additions and 7 deletions

View File

@@ -67,7 +67,6 @@ public:
};
private:
static const Count zero;
typedef std::map<std::string, Count> cnt_map_t;
cnt_map_t counts;
public:
@@ -80,11 +79,7 @@ public:
*/
void update();
const Count& operator[](const std::string& name) const
{
cnt_map_t::const_iterator it(counts.find(name));
return it==counts.end() ? zero : it->second;
}
const Count& operator[](const std::string& name) const;
iterator begin() const { return counts.begin(); }
iterator end() const { return counts.end(); }

View File

@@ -94,7 +94,14 @@ size_t readRefCounter(const char *name)
#endif
}
const RefSnapshot::Count RefSnapshot::zero;
const RefSnapshot::Count&
RefSnapshot::operator[](const std::string& name) const
{
static const Count zero;
cnt_map_t::const_iterator it(counts.find(name));
return it==counts.end() ? zero : it->second;
}
void RefSnapshot::update()
{