]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/type_traits/doc/is_assignable.qbk
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / type_traits / doc / is_assignable.qbk
CommitLineData
7c673cae
FG
1[/
2 Copyright 2015 John Maddock.
3 Distributed under the Boost Software License, Version 1.0.
4 (See accompanying file LICENSE_1_0.txt or copy at
5 http://www.boost.org/LICENSE_1_0.txt).
6]
7
8[section:is_assignable is_assignable]
9
10 template <class T, class U>
11 struct is_assignable : public __tof {};
12
13__inherit If `std::declval<T>() = std::declval<U>()` then inherits from __true_type,
14otherwise from __flase_type. Type `T` must be a complete type.
15
16Note that this trait is somewhat tricky to use correctly: for example:
17
18 is_assignable<int, int>::value
19
20is `false` since `std::declval<int>()` is an ['xvalue] which can not be assigned to!
21
22If you're intention is to check for copy-assignment from some type U then use:
23
24 is_assignable<T&, const U&>::value
25
26If you're intention is to check for move-assignment then use:
27
28 is_assignable<T&, U&&>::value
29
30or simply:
31
32 is_assignable<T&, U>::value
33
34
35__compat Requires the C++11 features `decltype` and SFINAE-expressions for full support.
36
37__header ` #include <boost/type_traits/is_assignable.hpp>` or ` #include <boost/type_traits.hpp>`
38
39[endsect]
40