aboutsummaryrefslogtreecommitdiff
path: root/cutl/shared-ptr
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-11-14 15:24:14 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-11-14 15:24:14 +0200
commit44fde85b2496750b78939247d1d19a67c5b3dc71 (patch)
treecb7f87c14037727ddc89bb7499457b5e3207ad98 /cutl/shared-ptr
parent7945c1771bbb57125b3e3343fa84bfc314e0f4d4 (diff)
C++11-compatibility fixes and improvements
Diffstat (limited to 'cutl/shared-ptr')
-rw-r--r--cutl/shared-ptr/base.cxx9
-rw-r--r--cutl/shared-ptr/base.hxx21
-rw-r--r--cutl/shared-ptr/base.ixx9
3 files changed, 28 insertions, 11 deletions
diff --git a/cutl/shared-ptr/base.cxx b/cutl/shared-ptr/base.cxx
index 1ff8469..4541e39 100644
--- a/cutl/shared-ptr/base.cxx
+++ b/cutl/shared-ptr/base.cxx
@@ -16,7 +16,7 @@ cutl::share exclusive = cutl::share (2);
namespace cutl
{
char const* not_shared::
- what () const throw ()
+ what () const LIBCUTL_NOTHROW_NOEXCEPT
{
return "object is not shared";
}
@@ -25,7 +25,10 @@ namespace cutl
//
//
void*
-operator new (size_t n, cutl::share s) throw (std::bad_alloc)
+operator new (size_t n, cutl::share s)
+#ifndef LIBCUTL_CXX11
+ throw (std::bad_alloc)
+#endif
{
if (s == shared)
{
@@ -45,7 +48,7 @@ operator new (size_t n, cutl::share s) throw (std::bad_alloc)
}
void
-operator delete (void* p, cutl::share s) throw ()
+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
diff --git a/cutl/shared-ptr/base.hxx b/cutl/shared-ptr/base.hxx
index f2bfecc..5eb1032 100644
--- a/cutl/shared-ptr/base.hxx
+++ b/cutl/shared-ptr/base.hxx
@@ -10,11 +10,12 @@
#include <cutl/exception.hxx>
+#include <cutl/details/config.hxx>
#include <cutl/details/export.hxx>
namespace cutl
{
- struct LIBCUTL_EXPORT share
+ struct share
{
explicit
share (char id);
@@ -30,18 +31,23 @@ namespace cutl
extern LIBCUTL_EXPORT cutl::share shared;
extern LIBCUTL_EXPORT cutl::share exclusive;
+#ifdef LIBCUTL_CXX11
+LIBCUTL_EXPORT void*
+operator new (std::size_t, cutl::share);
+#else
LIBCUTL_EXPORT void*
operator new (std::size_t, cutl::share) throw (std::bad_alloc);
+#endif
LIBCUTL_EXPORT void
-operator delete (void*, cutl::share) throw ();
+operator delete (void*, cutl::share) LIBCUTL_NOTHROW_NOEXCEPT;
namespace cutl
{
struct LIBCUTL_EXPORT not_shared: exception
{
virtual char const*
- what () const throw ();
+ what () const LIBCUTL_NOTHROW_NOEXCEPT;
};
struct LIBCUTL_EXPORT shared_base
@@ -60,14 +66,19 @@ namespace cutl
std::size_t
_ref_count () const;
+#ifdef LIBCUTL_CXX11
+ void*
+ operator new (std::size_t, share);
+#else
void*
operator new (std::size_t, share) throw (std::bad_alloc);
+#endif
void
- operator delete (void*, share) throw ();
+ operator delete (void*, share) LIBCUTL_NOTHROW_NOEXCEPT;
void
- operator delete (void*) throw ();
+ operator delete (void*) LIBCUTL_NOTHROW_NOEXCEPT;
protected:
std::size_t counter_;
diff --git a/cutl/shared-ptr/base.ixx b/cutl/shared-ptr/base.ixx
index 14dd0ac..3dd982b 100644
--- a/cutl/shared-ptr/base.ixx
+++ b/cutl/shared-ptr/base.ixx
@@ -59,19 +59,22 @@ namespace cutl
}
inline void* shared_base::
- operator new (std::size_t n, share) throw (std::bad_alloc)
+ operator new (std::size_t n, share)
+#ifndef LIBCUTL_CXX11
+ throw (std::bad_alloc)
+#endif
{
return ::operator new (n);
}
inline void shared_base::
- operator delete (void* p, share) throw ()
+ operator delete (void* p, share) LIBCUTL_NOTHROW_NOEXCEPT
{
::operator delete (p);
}
inline void shared_base::
- operator delete (void* p) throw ()
+ operator delete (void* p) LIBCUTL_NOTHROW_NOEXCEPT
{
::operator delete (p);
}