is_stateless.qbk 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. [section:is_stateless is_stateless]
  8. template <class T>
  9. struct is_stateless : public __tof {};
  10. __inherit If T is a stateless type then inherits from __true_type, otherwise
  11. from __false_type.
  12. Type T must be a complete type.
  13. A stateless type is a type that has no storage and whose constructors and
  14. destructors are trivial. That means that `is_stateless` only inherits from
  15. __true_type if the following expression is `true`:
  16. ::boost::has_trivial_constructor<T>::value
  17. && ::boost::has_trivial_copy<T>::value
  18. && ::boost::has_trivial_destructor<T>::value
  19. && ::boost::is_class<T>::value
  20. && ::boost::is_empty<T>::value
  21. __std_ref 3.9p10.
  22. __header ` #include <boost/type_traits/is_stateless.hpp>` or ` #include <boost/type_traits.hpp>`
  23. __compat Without some (as yet unspecified) help from the compiler, is_stateless will never
  24. report that a class or struct is stateless; this is always safe,
  25. if possibly sub-optimal.
  26. Currently (June 2015) compilers more recent than Visual C++ 8, Clang, GCC-4.3, Greenhills 6.0,
  27. Intel-11.0, and Codegear have the necessary compiler __intrinsics to ensure that this
  28. trait "just works".
  29. [endsect]