1 // Copyright (C) 2012 Vicente J. Botet Escriba
2 //
3 //  Distributed under the Boost Software License, Version 1.0. (See accompanying
4 //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 
6 #ifndef BOOST_THREAD_DETAIL_DELETE_HPP
7 #define BOOST_THREAD_DETAIL_DELETE_HPP
8 
9 #include <boost/config.hpp>
10 
11 /**
12  * BOOST_THREAD_DELETE_COPY_CTOR deletes the copy constructor when the compiler supports it or
13  * makes it private.
14  *
15  * BOOST_THREAD_DELETE_COPY_ASSIGN deletes the copy assignment when the compiler supports it or
16  * makes it private.
17  */
18 
19 #if ! defined BOOST_NO_CXX11_DELETED_FUNCTIONS && ! defined BOOST_NO_CXX11_RVALUE_REFERENCES
20 #define BOOST_THREAD_DELETE_COPY_CTOR(CLASS) \
21       CLASS(CLASS const&) = delete; \
22 
23 #define BOOST_THREAD_DELETE_COPY_ASSIGN(CLASS) \
24       CLASS& operator=(CLASS const&) = delete;
25 
26 #else // BOOST_NO_CXX11_DELETED_FUNCTIONS
27 #if defined(BOOST_MSVC) && _MSC_VER >= 1600
28 #define BOOST_THREAD_DELETE_COPY_CTOR(CLASS) \
29     private: \
30       CLASS(CLASS const&); \
31     public:
32 
33 #define BOOST_THREAD_DELETE_COPY_ASSIGN(CLASS) \
34     private: \
35       CLASS& operator=(CLASS const&); \
36     public:
37 #else
38 #define BOOST_THREAD_DELETE_COPY_CTOR(CLASS) \
39     private: \
40       CLASS(CLASS&); \
41     public:
42 
43 #define BOOST_THREAD_DELETE_COPY_ASSIGN(CLASS) \
44     private: \
45       CLASS& operator=(CLASS&); \
46     public:
47 #endif
48 #endif // BOOST_NO_CXX11_DELETED_FUNCTIONS
49 
50 /**
51  * BOOST_THREAD_NO_COPYABLE deletes the copy constructor and assignment when the compiler supports it or
52  * makes them private.
53  */
54 #define BOOST_THREAD_NO_COPYABLE(CLASS) \
55     BOOST_THREAD_DELETE_COPY_CTOR(CLASS) \
56     BOOST_THREAD_DELETE_COPY_ASSIGN(CLASS)
57 
58 #endif // BOOST_THREAD_DETAIL_DELETE_HPP
59