diff options
author | Hieu Hoang <s0565741@odin.inf.ed.ac.uk> | 2017-02-01 03:27:14 +0300 |
---|---|---|
committer | Hieu Hoang <s0565741@odin.inf.ed.ac.uk> | 2017-02-01 03:27:14 +0300 |
commit | 84b918b389e5a2d5e31cca993e1e53ff1354f1b1 (patch) | |
tree | b3891f5a5cfd55a41c9b75abe3b0040cc450a705 /moses2/Recycler.h | |
parent | adbb1c897a9ed019212dd7fc04e9a847e402e2d7 (diff) |
beautify
Diffstat (limited to 'moses2/Recycler.h')
-rw-r--r-- | moses2/Recycler.h | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/moses2/Recycler.h b/moses2/Recycler.h index 3751a2a93..60bdddf31 100644 --- a/moses2/Recycler.h +++ b/moses2/Recycler.h @@ -18,45 +18,37 @@ class Recycler { public: Recycler() : - m_currInd(0) - { + m_currInd(0) { } - virtual ~Recycler() - { + virtual ~Recycler() { } - T Get() - { + T Get() { if (!m_coll.empty()) { T &obj = m_coll.back(); m_coll.pop_back(); return obj; - } - else if (m_currInd) { + } else if (m_currInd) { --m_currInd; T &obj = m_all[m_currInd]; return obj; - } - else { + } else { return NULL; } } - void Clear() - { + void Clear() { m_coll.clear(); m_currInd = m_all.size(); } // call this for new objects when u 1st create it. It is assumed the object will be used right away - void Keep(const T& val) - { + void Keep(const T& val) { m_all.push_back(val); } // call this for existing object to put back into queue for reuse - void Recycle(const T& val) - { + void Recycle(const T& val) { m_coll.push_back(val); } |