extent.qbk 1.7 KB

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