]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/type_traits/doc/has_trivial_assign.qbk
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / type_traits / doc / has_trivial_assign.qbk
CommitLineData
7c673cae
FG
1[/
2 Copyright 2007 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:has_trivial_assign has_trivial_assign]
9 template <class T>
10 struct has_trivial_assign : public __tof {};
11
12__inherit If T is a (possibly cv-qualified) type with a trivial assignment-operator
13then inherits from __true_type, otherwise inherits from __false_type.
14
15If a type has a trivial assignment-operator then the operator has the same effect
16as copying the bits of one object to the other:
17calls to the operator can be safely replaced with a call to `memcpy`.
18
19__compat Without some (as yet unspecified) help from the compiler,
20has_trivial_assign will never report that a user-defined class or struct has a
21trivial constructor; this is always safe, if possibly sub-optimal. In order to
22correctly handle deleted or private assignment operators, the compiler must also
23support C++11's `decltype`.
24Currently (May 2015) compilers more recent than Visual C++ 8, GCC-4.3, Greenhills 6.0,
25Intel-11.0, and Codegear have the necessary compiler __intrinsics to ensure that this
26trait "just works". You may also test to see if the necessary __intrinsics are available
27by checking to see if the macro `BOOST_HAS_TRIVIAL_ASSIGN` is defined.
28
29
30__std_ref 12.8p11.
31
32__header ` #include <boost/type_traits/has_trivial_assign.hpp>` or ` #include <boost/type_traits.hpp>`
33
34__examples
35
36[:`has_trivial_assign<int>` inherits from `__true_type`.]
37
38[:`has_trivial_assign<char*>::type` is the type `__true_type`.]
39
40[:`has_trivial_assign<int (*)(long)>::value` is an integral constant
41expression that evaluates to /true/.]
42
43[:`has_trivial_assign<MyClass>::value` is an integral constant
44expression that evaluates to /false/.]
45
46[:`has_trivial_assign<T>::value_type` is the type `bool`.]
47
48[endsect]
49