summaryrefslogtreecommitdiff
path: root/src/utils.hh
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2014-11-02 16:04:24 +0000
committerMaxime Coste <frrrwww@gmail.com>2014-11-02 16:04:24 +0000
commitabfc016321a97d02915a3bd40ddfa46303e0b0df (patch)
treeba074be4d20aad1e628027210a0af7cf807c8cdf /src/utils.hh
parentb494b873b159fdf19a44e20cd61795fb7f1afaef (diff)
Remove AutoRegister util template
Diffstat (limited to 'src/utils.hh')
-rw-r--r--src/utils.hh57
1 files changed, 0 insertions, 57 deletions
diff --git a/src/utils.hh b/src/utils.hh
index 354c2fc3..9bb7c007 100644
--- a/src/utils.hh
+++ b/src/utils.hh
@@ -176,63 +176,6 @@ bool is_in_range(const T& val, const T& min, const T& max)
return min <= val and val <= max;
}
-// *** AutoRegister: RAII handling of value semantics registering classes ***
-
-template<typename EffectiveType, typename RegisterFuncs, typename Registry>
-class AutoRegister
-{
-public:
- AutoRegister(Registry& registry)
- : m_registry(&registry)
- {
- RegisterFuncs::insert(*m_registry, effective_this());
- }
-
- AutoRegister(const AutoRegister& other)
- : m_registry(other.m_registry)
- {
- RegisterFuncs::insert(*m_registry, effective_this());
- }
-
- AutoRegister(AutoRegister&& other)
- : m_registry(other.m_registry)
- {
- RegisterFuncs::insert(*m_registry, effective_this());
- }
-
- ~AutoRegister()
- {
- RegisterFuncs::remove(*m_registry, effective_this());
- }
-
- AutoRegister& operator=(const AutoRegister& other)
- {
- if (m_registry != other.m_registry)
- {
- RegisterFuncs::remove(*m_registry, effective_this());
- m_registry = other.m_registry;
- RegisterFuncs::insert(*m_registry, effective_this());
- }
- return *this;
- }
-
- AutoRegister& operator=(AutoRegister&& other)
- {
- if (m_registry != other.m_registry)
- {
- RegisterFuncs::remove(*m_registry, effective_this());
- m_registry = other.m_registry;
- RegisterFuncs::insert(*m_registry, effective_this());
- }
- return *this;
- }
- Registry& registry() const { return *m_registry; }
-
-private:
- EffectiveType& effective_this() { return static_cast<EffectiveType&>(*this); }
- Registry* m_registry;
-};
-
}
// std::pair hashing