has_trivial_move_assign.qbk 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. [/
  2. Copyright 2007 John Maddock.
  3. Copyright 2013 Antony Polukhin.
  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. [section:has_trivial_move_assign has_trivial_move_assign]
  9. template <class T>
  10. struct has_trivial_move_assign : public __tof {};
  11. __inherit If T is a (possibly cv-qualified) type with a trivial move assignment-operator
  12. then inherits from __true_type, otherwise inherits from __false_type.
  13. If a type has a trivial move assignment-operator then the operator has the same effect
  14. as copying the bits of one object to the other:
  15. calls to the operator can be safely replaced with a call to `memcpy`.
  16. __compat Without some (as yet unspecified) help from the compiler,
  17. has_trivial_move_assign will never report that a user-defined class or struct has a
  18. trivial move assign; this is always safe, if possibly sub-optimal.
  19. In addition, in order to correctly handle private or deleted move assignment
  20. operators then c++11's `decltype` is required.
  21. Currently (June 2015) compilers that have the necessary __intrinsics to ensure that this
  22. trait "just works" include Clang, GCC-5.1 and MSVC-12.0.
  23. You may also test to see if the necessary __intrinsics are available
  24. by checking to see if the macro `BOOST_HAS_TRIVIAL_MOVE_ASSIGN` is defined.
  25. __header ` #include <boost/type_traits/has_trivial_move_assign.hpp>` or ` #include <boost/type_traits.hpp>`
  26. __examples
  27. [:`has_trivial_move_assign<int>` inherits from `__true_type`.]
  28. [:`has_trivial_move_assign<char*>::type` is the type `__true_type`.]
  29. [:`has_trivial_move_assign<int (*)(long)>::value` is an integral constant
  30. expression that evaluates to /true/.]
  31. [:`has_trivial_move_assign<MyClass>::value` is an integral constant
  32. expression that evaluates to /false/.]
  33. [:`has_trivial_move_assign<T>::value_type` is the type `bool`.]
  34. [endsect]