This paper details use of the ISO C++0x constexpr feature, as initially introduced in “Generalized Constant Expressions — Revision 5” (N2235) and incorporating all other subsequent changes as per ISO C++ draft N3376. It is the first revision of N3305. Several CWG issues have also influenced the language with respect to constexpr: see issues 1099, 1125, 1194, 1195, 1197, 1198, 1199 and c++-std-core postings number 17890 and 17912. For pair and tuple, see N3140. Additional implementation experience, and subsequent changes to the core language have motivated the following changes and additions to the library specification.

Proposed Changes

A list of additional places in Chapters 18 Support or 20 Utilities that can exploit the constexpr language feature is below. For the changes listed, the new text is put in placein bold and green with the older text it is replacing struckthrough in red.

std::pair<std::string, int>’s copy constructor is still well-formed). The intent is

that all defaulted copy/move constructors are constexpr, if they can

be constexpr.

- Mark pair comparison operators ==, !=, >, >=, <, <= constexpr.

- Mark function template make_pair constexpr

03. <tuple>

Add the following:

- Mark non-defaulted tuple constructors constexpr (It is important that std::tuple<std::string>’ copy constructor is still well-formed). The intent is that all defaulted copy/move constructors are constexpr, if they can be constexpr.

and modify the following prototype declarations before paragraph 4, 6, 9, and 12 accordingly.

h) Add to 20.3.2 [pairs.pair] after paragraph 1 as follows:

The defaulted move and copy constructor, respectively, of pair shall be a constexpr function if and only if all required element-wise initializations for copy and move, respectively, would satisfy the requirements for a constexpr function.

The defaulted move and copy constructor, respectively, of tuple shall be a constexpr function if and only if all required element-wise initializations for copy and move, respectively, would satisfy the requirements for a constexpr function. The defaulted move and copy constructor of tuple<> shall be constexpr functions.