Opened 13 years ago

Closed 13 years ago

#3768 closed Bugs (fixed)

Incomplete documentation for type_traits::extent and type_traits::rank

Reported by: Edward Diener <eld@…> Owned by: John Maddock
Milestone: Boost 1.42.0 Component: type_traits
Version: Boost 1.41.0 Severity: Cosmetic
Keywords: extent rank Cc:

Description

The documentation for type_traits::extent is:

"Inherits: Class template extent inherits from integral_constant<std::size_t, EXTENT(T,N)>, where EXTENT(T,N) is the number of elements in the N'th array dimention of type T.

If T is not an array type, or if N > rank<T>::value, or if the N'th array bound is incomplete, then EXTENT(T,N) is zero."

This does not explain what this type_traits is about.

The documentation for type_traits::rank is:

" Inherits: Class template rank inherits from integral_constant<std::size_t, RANK(T)>, where RANK(T) is the number of array dimensions in type T.

If T is not an array type, then RANK(T) is zero. "

This does not explain what this type_traits is about.

Decent documentation for both of these would be welcome.

Change History (3)

comment:1 by anonymous, 13 years ago

So what would you suggest?

Inherits: Class template extent inherits from integral_constant<std::size_t, >EXTENT(T,N)>, where EXTENT(T,N) is the number of elements in the N'th array dimention >of type T. If T is not an array type, or if N > rank<T>::value, or if the N'th array bound is >incomplete, then EXTENT(T,N) is zero."

This does not explain what this type_traits is about.

Really? Concise maybe, but how does "where EXTENT(T,N) is the number of elements in the N'th array dimention of type T" not precisely describe the traits behaviour?

John.

in reply to:  1 comment:2 by Edward Diener <eld@…>, 13 years ago

Replying to anonymous:

So what would you suggest?

Inherits: Class template extent inherits from integral_constant<std::size_t, >EXTENT(T,N)>, where EXTENT(T,N) is the number of elements in the N'th array dimention >of type T. If T is not an array type, or if N > rank<T>::value, or if the N'th array bound is >incomplete, then EXTENT(T,N) is zero."

This does not explain what this type_traits is about.

Really? Concise maybe, but how does "where EXTENT(T,N) is the number of elements in the N'th array dimention of type T" not precisely describe the traits behaviour?

John.

I know it is said that:

'EXTENT(T,N) is the number of elements in the N'th array dimention of type T'

but I am not really sure what this means ( forget the misspelling of 'dimention', I know it is really 'dimension' ). Does this mean that T must be a C-style array ? If T must be a C-style array, does this mean that if T is, for example 'int [4][7]' that EXTENT(T,1) is 7 ? Or is there something else in both these assumptions.

Perhaps the problem is mine and I am looking into the words 'array' and 'dimension' for something that is not there.

comment:3 by John Maddock, 13 years ago

Resolution: fixed
Status: newclosed

(In [59472]) Clarify docs and add some more examples. Fixes #3768.

Note: See TracTickets for help on using tickets.