mirror of
https://github.com/Zygo/bees.git
synced 2025-06-17 01:56:16 +02:00
bees: clean up statistics class
Some whitespace fixes. Remove some duplicate code. Don't lock two BeesStats objects in the - operator method. Get the locking for T& at(const K&) right to avoid locking a mutex recursively. Make the non-const version of the function private. Signed-off-by: Zygo Blaxell <bees@furryterror.org>
This commit is contained in:
@ -155,12 +155,12 @@ class BeesStatTmpl {
|
||||
map<string, T> m_stats_map;
|
||||
mutable mutex m_mutex;
|
||||
|
||||
T& at(string idx);
|
||||
public:
|
||||
BeesStatTmpl() = default;
|
||||
BeesStatTmpl(const BeesStatTmpl &that);
|
||||
BeesStatTmpl &operator=(const BeesStatTmpl &that);
|
||||
void add_count(string idx, size_t amount = 1);
|
||||
T& at(string idx);
|
||||
T at(string idx) const;
|
||||
|
||||
friend ostream& operator<< <>(ostream &os, const BeesStatTmpl<T> &bs);
|
||||
|
Reference in New Issue
Block a user