is_copy_assignable.hpp
Go to the documentation of this file.
1 // (C) Copyright Ion Gaztanaga 2014.
2 //
3 // Use, modification and distribution are subject to the Boost Software License,
4 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt).
6 //
7 // See http://www.boost.org/libs/type_traits for most recent version including documentation.
8 
9 #ifndef BOOST_TT_IS_COPY_ASSIGNABLE_HPP_INCLUDED
10 #define BOOST_TT_IS_COPY_ASSIGNABLE_HPP_INCLUDED
11 
12 #include <boost/config.hpp>
15 #include <boost/noncopyable.hpp>
16 
17 #if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) && !defined(BOOST_NO_CXX11_DECLTYPE) \
18  && !defined(BOOST_INTEL_CXX_VERSION) && \
19  !(defined(BOOST_MSVC) && _MSC_VER == 1800)
20 #define BOOST_TT_CXX11_IS_COPY_ASSIGNABLE
22 #else
23  //For compilers without decltype
28 #endif
29 
30 namespace boost {
31 
32 namespace detail{
33 
34 template <bool DerivedFromNoncopyable, class T>
36 
37 // Intel compiler has problems with SFINAE for copy constructors and deleted functions:
38 //
39 // error: function *function_name* cannot be referenced -- it is a deleted function
40 // static boost::type_traits::yes_type test(T1&, decltype(T1(boost::declval<T1&>()))* = 0);
41 // ^
42 //
43 // MSVC 12.0 (Visual 2013) has problems when the copy constructor has been deleted. See:
44 // https://connect.microsoft.com/VisualStudio/feedback/details/800328/std-is-copy-constructible-is-broken
45 #if defined(BOOST_TT_CXX11_IS_COPY_ASSIGNABLE)
48 
49  template <class U>
50  static decltype(::boost::declval<U&>() = ::boost::declval<const U&>(), yes_type() ) test(int);
51 
52  template <class>
53  static no_type test(...);
54 
55  static const bool value = sizeof(test<T>(0)) == sizeof(yes_type);
56 
57 #else
59 
60  template <class T1>
61  static boost::type_traits::no_type test(T1&, typename T1::boost_move_no_copy_constructor_or_assign* = 0);
62 
64  // If you see errors like this:
65  //
66  // `'T::operator=(const T&)' is private`
67  // `boost/type_traits/is_copy_assignable.hpp:NN:M: error: within this context`
68  //
69  // then you are trying to call that macro for a structure defined like that:
70  //
71  // struct T {
72  // ...
73  // private:
74  // T & operator=(const T &);
75  // ...
76  // };
77  //
78  // To fix that you must modify your structure:
79  //
80  // // C++03 and C++11 version
81  // struct T: private boost::noncopyable {
82  // ...
83  // private:
84  // T & operator=(const T &);
85  // ...
86  // };
87  //
88  // // C++11 version
89  // struct T {
90  // ...
91  // private:
92  // T& operator=(const T &) = delete;
93  // ...
94  // };
96  sizeof(test(produce())) == sizeof(boost::type_traits::yes_type)
97  ));
98  #endif
99 };
100 
101 template <class T>
103  BOOST_STATIC_CONSTANT(bool, value = false);
104 };
105 
106 template <class T>
108 
109 #if !defined(BOOST_TT_CXX11_IS_COPY_ASSIGNABLE)
110  //For compilers without decltype, at least return false on const types, arrays
111  //types derived from boost::noncopyable and types defined as BOOST_MOVEABLE_BUT_NOT_COPYABLE
113  BOOST_STATIC_CONSTANT(bool, value = (
117  ,T
118  >::value
119  ));
120  #else
121  BOOST_STATIC_CONSTANT(bool, value = (
124  >::value
125  ));
126  #endif
127 };
128 
129 } // namespace detail
130 
131 template <class T> struct is_copy_assignable : public integral_constant<bool, ::boost::detail::is_copy_assignable_impl<T>::value>{};
132 template <> struct is_copy_assignable<void> : public false_type{};
133 #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
134 template <> struct is_copy_assignable<void const> : public false_type{};
135 template <> struct is_copy_assignable<void const volatile> : public false_type{};
136 template <> struct is_copy_assignable<void volatile> : public false_type{};
137 #endif
138 
139 } // namespace boost
140 
141 #endif // BOOST_TT_IS_COPY_ASSIGNABLE_HPP_INCLUDED
boost::detail::remove_rvalue_ref< T >::type type
static decltype(::boost::declval< U & >()=::boost::declval< const U & >(), yes_type()) test(int)
typedef void(APIENTRY *GLDEBUGPROC)(GLenum source
BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE.
GLfloat value
#define BOOST_DEDUCED_TYPENAME
Definition: suffix.hpp:465
const char * detail
#define BOOST_STATIC_CONSTANT(type, assignment)
Definition: suffix.hpp:394
boost::detail::add_reference_impl< T >::type type


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:47:17