]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/type_traits/doc/is_copy_assignable.qbk
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / type_traits / doc / is_copy_assignable.qbk
CommitLineData
7c673cae
FG
1[/
2 Copyright 2007 John Maddock.
3 Copyright 2014 Ion Gaztanaga.
4 Distributed under the Boost Software License, Version 1.0.
5 (See accompanying file LICENSE_1_0.txt or copy at
6 http://www.boost.org/LICENSE_1_0.txt).
7]
8
9[section:is_copy_assignable is_copy_assignable]
10
11 template <class T>
12 struct is_copy_assignable : public __tof {};
13
14__inherit If `T` is `CopyAssignable` (i.e. has an accessible explicit or implicit copy assignment operator),
15then inherits from __true_type, otherwise inherits from __false_type. Type `T`
16must be a complete type.
17
18In other words, inherits from __true_type only if copy assignment of `T` from `const T &` is not
19marked with `= delete`, `T` does not derives from `boost::noncopyable` and
20is not marked with `BOOST_MOVABLE_BUT_NOT_COPYABLE(T)`.
21
22__compat Requires the C++11 features `decltype` and SFINAE-expressions for full support.
23
24If your compiler does not support C++11 deleted functions (`= delete`) or does not support
25SFINAE for the deleted assignments, then derive your classes from `boost::noncopyable` or
26mark them with `BOOST_MOVABLE_BUT_NOT_COPYABLE(T)` to show that class is non-assignable.
27
28Trait does not care about access modifiers, so if you see errors like this:
29
30 'T::operator=(const T&)' is private
31 boost/type_traits/is_copy_assignable.hpp:68:5: error: within this context
32
33then you are trying to call that macro for a structure with private assignment:
34
35 struct T {
36 // ...
37 private:
38 T &operator=(const T &);
39 // ...
40 };
41
42To fix that you must modify your structure, explicitly marking it as noncopyable (`= delete`,
43`boost::noncopyable` or `BOOST_MOVABLE_BUT_NOT_COPYABLE(T)`) or explicitly
44[link boost_typetraits.user_defined specializing the trait].
45
46
47__header ` #include <boost/type_traits/is_copy_assignable.hpp>` or ` #include <boost/type_traits.hpp>`
48
49[endsect]
50