Document number: P1424R0
Project: Programming Language C++
Audience: SG10, Library Working group
 
Antony Polukhin <antoshkka@gmail.com>, <antoshkka@yandex-team.ru>
 
Date: 2018-12-26

'constexpr' feature macro concerns

I. Quick Introduction

In P1032R1 "Misc constexpr bits" a feature testing macro __cpp_lib_constexpr_misc was proposed.

That's not the best name for the macro. The name is not very informative. __cpp_lib_constexpr_misc also does not suite the needs of future constexprifications.

This paper discuss different approaches for constexpr feature testing macro.

II. Approaches

A. Single constexpr feature testing macro

Make a __cpp_lib_constexpr macro and increment its version on each new constexpr addition to the library.

Pros:

Cons:

B. Fuse constexpr feature testing into the feature testing macro of a component

Update the value of feature testing macro of a particular component. For example, update _­_­cpp_­lib_­string_­view with value 201811L because P1032R1 "Misc constexpr bits" touched the string_view.

Pros:

Cons:

C. Have a feature testing macro per paper/proposal

This approach was taken by the P1032R1 with its __cpp_lib_constexpr_misc macro.

Pros:

Cons:

III. Conclusions

Each approach has its own advantages and disadvantages. I'd like recommend the following generic approach: