blob: 3ae9d1118b9e36c40ea73028e3d250763fd43ea5 [file] [log] [blame]
Jeff Thompsona28eed82013-08-22 16:21:10 -07001// Boost noncopyable.hpp header file --------------------------------------//
2
3// (C) Copyright Beman Dawes 1999-2003. Distributed under the Boost
4// Software License, Version 1.0. (See accompanying file
5// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6
7// See http://www.boost.org/libs/utility for documentation.
8
Jeff Thompson3d613fd2013-10-15 15:39:04 -07009#ifndef NDNBOOST_NONCOPYABLE_HPP_INCLUDED
10#define NDNBOOST_NONCOPYABLE_HPP_INCLUDED
Jeff Thompsona28eed82013-08-22 16:21:10 -070011
12#include <ndnboost/config.hpp>
13
14namespace ndnboost {
15
16// Private copy constructor and copy assignment ensure classes derived from
17// class noncopyable cannot be copied.
18
19// Contributed by Dave Abrahams
20
21namespace noncopyable_ // protection from unintended ADL
22{
23 class noncopyable
24 {
25 protected:
Jeff Thompson3d613fd2013-10-15 15:39:04 -070026#ifndef NDNBOOST_NO_DEFAULTED_FUNCTIONS
27 NDNBOOST_CONSTEXPR noncopyable() = default;
Jeff Thompsona28eed82013-08-22 16:21:10 -070028 ~noncopyable() = default;
29#else
30 noncopyable() {}
31 ~noncopyable() {}
32#endif
Jeff Thompson3d613fd2013-10-15 15:39:04 -070033#ifndef NDNBOOST_NO_DELETED_FUNCTIONS
Jeff Thompsona28eed82013-08-22 16:21:10 -070034 noncopyable( const noncopyable& ) = delete;
35 noncopyable& operator=( const noncopyable& ) = delete;
36#else
37 private: // emphasize the following members are private
38 noncopyable( const noncopyable& );
39 noncopyable& operator=( const noncopyable& );
40#endif
41 };
42}
43
44typedef noncopyable_::noncopyable noncopyable;
45
46} // namespace ndnboost
47
Jeff Thompson3d613fd2013-10-15 15:39:04 -070048#endif // NDNBOOST_NONCOPYABLE_HPP_INCLUDED