diff --git a/dlib/array2d/array2d_kernel.h b/dlib/array2d/array2d_kernel.h index 3e2b1468c..828eca3cf 100644 --- a/dlib/array2d/array2d_kernel.h +++ b/dlib/array2d/array2d_kernel.h @@ -160,6 +160,9 @@ namespace dlib set_size(rows,cols); } + array2d(const array2d&) = delete; // copy constructor + array2d& operator=(const array2d&) = delete; // assignment operator + #ifdef DLIB_HAS_RVALUE_REFERENCES array2d(array2d&& item) : array2d() { @@ -330,10 +333,6 @@ namespace dlib T* last; mutable bool at_start_; - // restricted functions - array2d(array2d&); // copy constructor - array2d& operator=(array2d&); // assignment operator - }; // ---------------------------------------------------------------------------------------- diff --git a/dlib/array2d/array2d_kernel_abstract.h b/dlib/array2d/array2d_kernel_abstract.h index 82824dec6..cbb0e9b2b 100644 --- a/dlib/array2d/array2d_kernel_abstract.h +++ b/dlib/array2d/array2d_kernel_abstract.h @@ -122,6 +122,9 @@ namespace dlib - std::bad_alloc !*/ + array2d(const array2d&) = delete; // copy constructor + array2d& operator=(const array2d&) = delete; // assignment operator + array2d( array2d&& item ); @@ -252,12 +255,6 @@ namespace dlib An example of such an object is the dlib::cv_image. !*/ - private: - - // restricted functions - array2d(array2d&); // copy constructor - array2d& operator=(array2d&); // assignment operator - }; template < diff --git a/dlib/noncopyable.h b/dlib/noncopyable.h index cbb603bcd..20b9866e7 100644 --- a/dlib/noncopyable.h +++ b/dlib/noncopyable.h @@ -19,8 +19,8 @@ namespace dlib !*/ protected: - noncopyable() {} - ~noncopyable() {} + noncopyable() = default; + ~noncopyable() = default; private: // emphasize the following members are private noncopyable(const noncopyable&); const noncopyable& operator=(const noncopyable&);