This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++14 status.

### 2317. The type property queries should be `UnaryTypeTraits` returning `size_t`

Section: 20.15.6 [meta.unary.prop.query] Status: C++14 Submitter: Stephan T. Lavavej Opened: 2013-09-21 Last modified: 2017-07-05

Priority: 0

View all issues with C++14 status.

Discussion:

The sibling sections 20.15.5 [meta.unary], 20.15.7 [meta.rel], and 20.15.8 [meta.trans] respectively specify `UnaryTypeTraits`, `BinaryTypeTraits`, and `TransformationTraits`, as stated by each /2 paragraph. However, 20.15.6 [meta.unary.prop.query] is underspecified. `alignment_of`, `rank`, and `extent` are said to produce "Values", but the type of that Value is not specified, and the struct templates are not required to derive from `integral_constant`. Such derivation is more than stylistic — it allows the structs to be passed to functions taking `integral_constant`.

`alignment_of` returns `alignof(T)` which is `size_t` (7.6.2.6 [expr.alignof]/2). `extent` returns an array bound, which is clearly `size_t`. `rank` returns "the number of dimensions" of an array, so any type could be chosen, with `size_t` being a reasonable choice. (Another choice would be `unsigned int`, to match `extent`'s template parameter `I`.)

[Issaquah 2014-02-11: Move to Immediate]

Proposed resolution:

This wording is relative to N3691.

1. Following 20.15.6 [meta.unary.prop.query]/1 add a new paragraph as indicated:

   > Each of these templates shall be a `UnaryTypeTrait` (20.15.2 [meta.rqmts]) with a `BaseCharacteristic` of `integral_constant<size_t, Value>`.