1361. Does use of std::size_t in a header imply that typedef name is available to users?

Section: 16.4.3 [using] Status: NAD Submitter: BSI Opened: 2010-08-25 Last modified: 2016-01-28 10:19:27 UTC

Priority: Not Prioritized

View all issues with NAD status.


Addresses GB-58

It is not clear whether a library header specified in terms of a typedef name makes that same typedef name available for use, or if it simply requires that the specified type is an alias of the same type, and so the typedef name cannot be used without including the specific header that defines it. For example, is the following code required to be accepted:

#include <vector>
std::size_t x = 0;

Most often, this question concerns the typedefs defined in header <cstddef>

[ Resolution proposed by ballot comment: ]

Add a paragraph under 16.4.3 [using] clarifying whether or not headers specified in terms of std::size_t can be used to access the typedef size_t, or whether the header <cstddef> must be included to reliably use this name.

[Batavia: NAD - see rationale below]

Proposed resolution:


The standard is correct as written.