Commit a9a1633f authored by Davis King's avatar Davis King

Removed auto_ptr from these old smart pointers since auto_ptr is officially

removed in C++17 from the standard library.
parent d9b6f001
......@@ -10,14 +10,6 @@
#include "../algs.h"
#include "shared_ptr_abstract.h"
// Don't warn about the use of std::auto_ptr in this file. There is a pragma at the end of
// this file that re-enables the warning.
#if (defined(__GNUC__) && ((__GNUC__ >= 4 && __GNUC_MINOR__ >= 6) || (__GNUC__ > 4))) || \
(defined(__clang__) && ((__clang_major__ >= 3 && __clang_minor__ >= 4)))
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
namespace dlib
{
......@@ -301,21 +293,6 @@ namespace dlib
shared_node->ref_count += 1;
}
template<typename Y>
explicit shared_ptr(
std::auto_ptr<Y>& r
)
{
DLIB_ASSERT(r.get() != 0,
"\tshared_ptr::shared_ptr(auto_ptr r)"
<< "\n\tr.get() can't be null"
<< "\n\tthis: " << this
);
shared_node = new shared_ptr_node;
shared_node->del = new default_deleter;
data = r.release();
}
shared_ptr& operator= (
const shared_ptr& r
)
......@@ -333,24 +310,6 @@ namespace dlib
return *this;
}
template<typename Y>
shared_ptr& operator= (
std::auto_ptr<Y>& r
)
{
DLIB_ASSERT(r.get() != 0,
"\tshared_ptr::operator=(auto_ptr r)"
<< "\n\tr.get() can't be null"
<< "\n\tthis: " << this
);
reset();
shared_node = new shared_ptr_node;
shared_node->del = new default_deleter;
data = r.release();
return *this;
}
void reset()
{
shared_ptr().swap(*this);
......@@ -528,10 +487,6 @@ namespace dlib
}
#if (defined(__GNUC__) && ((__GNUC__ >= 4 && __GNUC_MINOR__ >= 6) || (__GNUC__ > 4))) || \
(defined(__clang__) && ((__clang_major__ >= 3 && __clang_minor__ >= 4)))
#pragma GCC diagnostic pop
#endif
#endif // DLIB_SHARED_PTr_
......@@ -136,24 +136,6 @@ namespace dlib
this exception is thrown if r.expired() == true
!*/
template<typename Y>
explicit shared_ptr(
std::auto_ptr<Y>& r
);
/*!
requires
- p.get() != 0
- p.release() is convertible to a T* type pointer
- p.release() can be deleted by calling "delete p.release();" and doing so will not throw exceptions
ensures
- #get() == p.release()
- #use_count() == 1
- #r.get() == 0
- #*this object owns the pointer p.release()
throws
- std::bad_alloc
!*/
~shared_ptr(
);
/*!
......@@ -190,20 +172,6 @@ namespace dlib
- returns #*this
!*/
template<typename Y>
shared_ptr& operator= (
std::auto_ptr<Y>& r
);
/*!
requires
- p.get() != 0
- p.release() is convertible to a T* type pointer
- p.release() can be deleted by calling "delete p.release();" and doing so will not throw exceptions
ensures
- equivalent to shared_ptr(r).swap(*this).
- returns #*this
!*/
void reset(
);
/*!
......
......@@ -11,13 +11,6 @@
#include "shared_ptr_thread_safe_abstract.h"
#include "../threads/threads_kernel.h"
// Don't warn about the use of std::auto_ptr in this file. There is a pragma at the end of
// this file that re-enables the warning.
#if defined(__GNUC__) && ((__GNUC__ >= 4 && __GNUC_MINOR__ >= 6) || (__GNUC__ > 4))
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
namespace dlib
{
......@@ -264,20 +257,6 @@ namespace dlib
}
}
template<typename Y>
explicit shared_ptr_thread_safe(
std::auto_ptr<Y>& r
)
{
DLIB_ASSERT(r.get() != 0,
"\tshared_ptr::shared_ptr_thread_safe(auto_ptr r)"
<< "\n\tr.get() can't be null"
<< "\n\tthis: " << this
);
shared_node = new shared_ptr_thread_safe_node;
data = r.release();
}
shared_ptr_thread_safe& operator= (
const shared_ptr_thread_safe& r
)
......@@ -295,23 +274,6 @@ namespace dlib
return *this;
}
template<typename Y>
shared_ptr_thread_safe& operator= (
std::auto_ptr<Y>& r
)
{
DLIB_ASSERT(r.get() != 0,
"\tshared_ptr::operator=(auto_ptr r)"
<< "\n\tr.get() can't be null"
<< "\n\tthis: " << this
);
reset();
shared_node = new shared_ptr_thread_safe_node;
data = r.release();
return *this;
}
void reset()
{
shared_ptr_thread_safe().swap(*this);
......@@ -494,10 +456,6 @@ namespace dlib
// ----------------------------------------------------------------------------------------
#if defined(__GNUC__) && ((__GNUC__ >= 4 && __GNUC_MINOR__ >= 6) || (__GNUC__ > 4))
#pragma GCC diagnostic pop
#endif
}
#endif // DLIB_SHARED_THREAD_SAFE_PTr_
......
......@@ -114,24 +114,6 @@ namespace dlib
a shared_ptr_thread_safe object that shares ownership with r.
!*/
template<typename Y>
explicit shared_ptr_thread_safe(
std::auto_ptr<Y>& r
);
/*!
requires
- p.get() != 0
- p.release() is convertible to a T* type pointer
- p.release() can be deleted by calling "delete p.release();" and doing so will not throw exceptions
ensures
- #get() == p.release()
- #use_count() == 1
- #r.get() == 0
- #*this object owns the pointer p.release()
throws
- std::bad_alloc
!*/
~shared_ptr_thread_safe(
);
/*!
......@@ -168,20 +150,6 @@ namespace dlib
- returns #*this
!*/
template<typename Y>
shared_ptr_thread_safe& operator= (
std::auto_ptr<Y>& r
);
/*!
requires
- p.get() != 0
- p.release() is convertible to a T* type pointer
- p.release() can be deleted by calling "delete p.release();" and doing so will not throw exceptions
ensures
- equivalent to shared_ptr_thread_safe(r).swap(*this).
- returns #*this
!*/
void reset(
);
/*!
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment