is_pod.qbk 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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_pod is_pod]
  8. template <class T>
  9. struct is_pod : public __tof {};
  10. __inherit If T is a (possibly cv-qualified) POD type then inherits from __true_type,
  11. otherwise inherits from __false_type.
  12. POD stands for "Plain old data".
  13. Arithmetic types, and enumeration types,
  14. a pointers and pointer to members are all PODs. Classes and unions can also
  15. be POD's if they have no non-static data members that are of reference or
  16. non-POD type, no user defined constructors, no user defined assignment
  17. operators, no private or protected non-static data members,
  18. no virtual functions and no base classes. Finally, a cv-qualified POD is
  19. still a POD, as is an array of PODs.
  20. __std_ref 3.9p10 and 9p4 (Note that POD's are also aggregates, see 8.5.1).
  21. __compat Without some (as yet unspecified) help from the compiler, is_pod will
  22. never report that a class or struct is a POD; this is always safe,
  23. if possibly sub-optimal.
  24. Currently (June 2015) compilers more recent than Visual C++ 8, Clang-3, GCC-4.3, Greenhills 6.0,
  25. Intel-11.0, and Codegear have the necessary compiler __intrinsics to ensure that this
  26. trait "just works". You may also test to see if the necessary __intrinsics are available
  27. by checking to see if the macro `BOOST_IS_POD` is defined.
  28. __header ` #include <boost/type_traits/is_pod.hpp>` or ` #include <boost/type_traits.hpp>`
  29. __examples
  30. [:`is_pod<int>` inherits from `__true_type`.]
  31. [:`is_pod<char*>::type` is the type `__true_type`.]
  32. [:`is_pod<int (*)(long)>::value` is an integral constant
  33. expression that evaluates to /true/.]
  34. [:`is_pod<MyClass>::value` is an integral constant
  35. expression that evaluates to /false/.]
  36. [:`is_pod<T>::value_type` is the type `bool`.]
  37. [endsect]