From f8aa53fe714e5d80f112bbdea99d5ba37f230d4b Mon Sep 17 00:00:00 2001 From: "Vicente J. Botet Escriba" Date: Wed, 10 Apr 2013 17:16:02 +0000 Subject: [PATCH] Utility/noncopyable: Make use of =delete #6578. [SVN r83833] --- include/boost/noncopyable.hpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/include/boost/noncopyable.hpp b/include/boost/noncopyable.hpp index 7770bdb..eb8e2e7 100644 --- a/include/boost/noncopyable.hpp +++ b/include/boost/noncopyable.hpp @@ -9,6 +9,8 @@ #ifndef BOOST_NONCOPYABLE_HPP_INCLUDED #define BOOST_NONCOPYABLE_HPP_INCLUDED +#include + namespace boost { // Private copy constructor and copy assignment ensure classes derived from @@ -21,11 +23,21 @@ namespace noncopyable_ // protection from unintended ADL class noncopyable { protected: - noncopyable() {} +#ifndef BOOST_NO_DEFAULTED_FUNCTIONS + BOOST_CONSTEXPR noncopyable() = default; + ~noncopyable() = default; +#else + noncopyable() {} ~noncopyable() {} - private: // emphasize the following members are private +#endif +#ifndef BOOST_NO_DELETED_FUNCTIONS + noncopyable( const noncopyable& ) = delete; + noncopyable& operator=( const noncopyable& ) = delete; +#else + private: // emphasize the following members are private noncopyable( const noncopyable& ); - const noncopyable& operator=( const noncopyable& ); + noncopyable& operator=( const noncopyable& ); +#endif }; }