Utility/noncopyable: Make use of =delete #6578.

[SVN r83833]
This commit is contained in:
Vicente J. Botet Escriba
2013-04-10 17:16:02 +00:00
committed by Peter Dimov
parent 3803997b5b
commit 83edb7e6de

View File

@@ -9,6 +9,8 @@
#ifndef BOOST_NONCOPYABLE_HPP_INCLUDED #ifndef BOOST_NONCOPYABLE_HPP_INCLUDED
#define BOOST_NONCOPYABLE_HPP_INCLUDED #define BOOST_NONCOPYABLE_HPP_INCLUDED
#include <boost/config.hpp>
namespace boost { namespace boost {
// Private copy constructor and copy assignment ensure classes derived from // Private copy constructor and copy assignment ensure classes derived from
@@ -21,11 +23,21 @@ namespace noncopyable_ // protection from unintended ADL
class noncopyable class noncopyable
{ {
protected: protected:
#ifndef BOOST_NO_DEFAULTED_FUNCTIONS
BOOST_CONSTEXPR noncopyable() = default;
~noncopyable() = default;
#else
noncopyable() {} noncopyable() {}
~noncopyable() {} ~noncopyable() {}
#endif
#ifndef BOOST_NO_DELETED_FUNCTIONS
noncopyable( const noncopyable& ) = delete;
noncopyable& operator=( const noncopyable& ) = delete;
#else
private: // emphasize the following members are private private: // emphasize the following members are private
noncopyable( const noncopyable& ); noncopyable( const noncopyable& );
const noncopyable& operator=( const noncopyable& ); noncopyable& operator=( const noncopyable& );
#endif
}; };
} }