diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2011-09-23 14:26:53 +0000 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2011-09-23 14:26:53 +0000 |
| commit | 26537d7028afe67bcf78c24374f948f4f1fddc6b (patch) | |
| tree | 69d513c8810a2976aad20fdc9bd40da4687cbc44 /src/buffer_manager.hh | |
| parent | 52ad372adbef14f0acec0e69edc3678284abafdd (diff) | |
Utils: Singleton template and migration of the BufferManager
Singletons are not autocreating, the application needs to create
exactly one instance (I want to avoid implicit initialization order
hell)
Diffstat (limited to 'src/buffer_manager.hh')
| -rw-r--r-- | src/buffer_manager.hh | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/buffer_manager.hh b/src/buffer_manager.hh index b0cd9518..126b41a3 100644 --- a/src/buffer_manager.hh +++ b/src/buffer_manager.hh @@ -2,6 +2,7 @@ #define buffer_manager_hh_INCLUDED #include "buffer.hh" +#include "utils.hh" #include <unordered_map> #include <memory> @@ -9,7 +10,7 @@ namespace Kakoune { -class BufferManager +class BufferManager : public Singleton<BufferManager> { public: typedef std::unordered_map<std::string, std::unique_ptr<Buffer>> BufferMap; @@ -32,12 +33,7 @@ public: Buffer* get_buffer(const std::string& name); - static BufferManager& instance(); - static void delete_instance(); - private: - BufferManager(); - static BufferManager* ms_instance; BufferMap m_buffers; }; |
