diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2024-03-06 10:24:11 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2024-03-06 10:24:11 +0100 |
commit | 4538829ab86b5a1cd4e845e7eab165029c9d6d46 (patch) | |
tree | bbadf39aed0610c8f8f7b41fefff47773b8ac205 /libcutl/cutl/static-ptr.hxx | |
parent | 23d41842168ac1a1580111b9c5c73500ceee3d57 (diff) | |
parent | aad5ad9bf0c02aa4e79bc6b7d6c934612fff4026 (diff) |
Update upstream source from tag 'upstream/4.2.0'
Update to upstream version '4.2.0'
with Debian dir 1b38df7bbcf313223de3c50107ac0255090fe647
Diffstat (limited to 'libcutl/cutl/static-ptr.hxx')
-rw-r--r-- | libcutl/cutl/static-ptr.hxx | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/libcutl/cutl/static-ptr.hxx b/libcutl/cutl/static-ptr.hxx deleted file mode 100644 index 6c907c8..0000000 --- a/libcutl/cutl/static-ptr.hxx +++ /dev/null @@ -1,74 +0,0 @@ -// file : cutl/static-ptr.hxx -// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC -// license : MIT; see accompanying LICENSE file - -#ifndef CUTL_STATIC_PTR_HXX -#define CUTL_STATIC_PTR_HXX - -#include <cstddef> // 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 <typename X, typename ID> - 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 <typename X, typename ID> - X* static_ptr<X, ID>::x_ = 0; - - template <typename X, typename ID> - std::size_t static_ptr<X, ID>::count_ = 0; -} - -#endif // CUTL_STATIC_PTR_HXX |