diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2020-12-16 20:29:05 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2021-02-24 16:40:04 +0300 |
commit | 8e761289a2446367267c6c0d9a26e734f0f78306 (patch) | |
tree | fb495d8c18801f271d124ee48731f10df396ca89 /cutl/shared-ptr/base.cxx | |
parent | 4c8104756b92b9fa16b3a725e8a6aa620dfd606e (diff) |
Get rid of legacy build systems and rename cutl/ to libcutl/
Diffstat (limited to 'cutl/shared-ptr/base.cxx')
-rw-r--r-- | cutl/shared-ptr/base.cxx | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/cutl/shared-ptr/base.cxx b/cutl/shared-ptr/base.cxx deleted file mode 100644 index 913e6f2..0000000 --- a/cutl/shared-ptr/base.cxx +++ /dev/null @@ -1,64 +0,0 @@ -// file : cutl/shared-ptr/base.cxx -// license : MIT; see accompanying LICENSE file - -#include <cutl/shared-ptr/base.hxx> - -using std::size_t; - -// -// -cutl::share shared = cutl::share (1); -cutl::share exclusive = cutl::share (2); - -// -// -namespace cutl -{ - char const* not_shared:: - what () const LIBCUTL_NOTHROW_NOEXCEPT - { - return "object is not shared"; - } -} - -// -// -void* -operator new (size_t n, cutl::share s) -#ifndef LIBCUTL_CXX11 - throw (std::bad_alloc) -#endif -{ - if (s == shared) - { - // Here we need to make sure we don't break the alignment of the - // returned block. For that we need to know the maximum alignment - // of this platform. Twice the pointer size is a good guess for - // most platforms. - // - size_t* p = static_cast<size_t*> (operator new (n + 2 * sizeof (size_t))); - *p++ = 1; // Initial count. - *p++ = 0xDEADBEEF; // Signature. - return p; - } - else - return operator new (n); - -} - -void -operator delete (void* p, cutl::share s) LIBCUTL_NOTHROW_NOEXCEPT -{ - // This version of operator delete is only called when the c-tor - // fails. In this case there is no object and we can just free the - // memory. - // - if (s == shared) - { - size_t* sp = static_cast<size_t*> (p); - sp -= 2; - operator delete (sp); - } - else - operator delete (p); -} |