rank.qbk 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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:rank rank]
  8. template <class T>
  9. struct rank : public __integral_constant<std::size_t, RANK(T)> {};
  10. __inherit Class template rank inherits from `__integral_constant<std::size_t, RANK(T)>`,
  11. where `RANK(T)` is the number of array dimensions in type `T`.
  12. If `T` is not a (built-in) array type, then `RANK(T)` is zero.
  13. [all_compilers]
  14. __header ` #include <boost/type_traits/rank.hpp>` or ` #include <boost/type_traits.hpp>`
  15. __examples
  16. [:`rank<int[]>` inherits from `__integral_constant<std::size_t, 1>`.]
  17. [:`rank<double[2][3][4]>::type` is the type `__integral_constant<std::size_t, 3>`.]
  18. [:`rank<int[1]>::value` is an integral constant
  19. expression that evaluates to /1/.]
  20. [:`rank<int[][2]>::value` is an integral constant
  21. expression that evaluates to /2/.]
  22. [:`rank<int*>::value` is an integral constant
  23. expression that evaluates to /0/.]
  24. [:`rank<boost::array<int, 3> >::value` is an integral constant
  25. expression that evaluates to /0/: `boost::array` is a class type and [*not an array type]!]
  26. [:`rank<T>::value_type` is the type `std::size_t`.]
  27. [endsect]