From 8e761289a2446367267c6c0d9a26e734f0f78306 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 16 Dec 2020 20:29:05 +0300 Subject: Get rid of legacy build systems and rename cutl/ to libcutl/ --- cutl/static-ptr.hxx | 73 ----------------------------------------------------- 1 file changed, 73 deletions(-) delete mode 100644 cutl/static-ptr.hxx (limited to 'cutl/static-ptr.hxx') diff --git a/cutl/static-ptr.hxx b/cutl/static-ptr.hxx deleted file mode 100644 index 5ac15d8..0000000 --- a/cutl/static-ptr.hxx +++ /dev/null @@ -1,73 +0,0 @@ -// file : cutl/static-ptr.hxx -// license : MIT; see accompanying LICENSE file - -#ifndef CUTL_STATIC_PTR_HXX -#define CUTL_STATIC_PTR_HXX - -#include // std::size_t - -namespace cutl -{ - // This class template implements Jerry Schwarz's static - // initialization technique commonly found in iostream - // implementations. - // - // The second template argument is used to make sure the - // instantiation of static_ptr is unique. - // - template - class static_ptr - { - public: - static_ptr () - { - if (count_ == 0) - x_ = new X; - - ++count_; - } - - ~static_ptr () - { - if (--count_ == 0) - delete x_; - } - - private: - static_ptr (static_ptr const&); - - static_ptr& - operator= (static_ptr const&); - - public: - X* - operator-> () const - { - return x_; - } - - X& - operator* () const - { - return *x_; - } - - X* - get () const - { - return x_; - } - - private: - static X* x_; - static std::size_t count_; - }; - - template - X* static_ptr::x_ = 0; - - template - std::size_t static_ptr::count_ = 0; -} - -#endif // CUTL_STATIC_PTR_HXX -- cgit v1.1