Constants in std::regex_constants should be allowed to be enumerators
Jiang An

Created on 2023-10-18.00:00:00 last changed 4 months ago


Date: 2024-02-22.16:46:19

[ Jonathan commented ]

"Why only change the `regex_constants` bitmask constants, and not those for ctype_base::mask, ios_base::fmtflags, ios_base::iostate, and ios_base::openmode?"

Date: 2024-02-15.00:00:00

[ 2024-02-22; Reflector poll ]

Set priority to 3 after reflector poll in October 2023.

Date: 2023-10-18.00:00:00

Currently, MSVC STL and libc++ implement constants in std::regex_constants as enumerators of unscoped enumerations, while the standard specify them to be constexpr variables.

Casey Carter argued that it would be better to make these constants prvalues to avoid wasting space in object files. And presumably almost all users just use their values without odr-using them or relying on their value category.

Perhaps we should allow these constants to be enumerators of the corresponding type (syntax_option_type, match_flag_type, or error_type) if the corresponding type is an enumeration.

Notes: since C++20, we can even make the enumeration types scoped and expose the enumerators to the namespace by using-declaration or using-enum-declaration. P0439R0 might be related, since it changed former enumerators to constexpr variables.

Date User Action Args
2024-02-22 16:46:19adminsetmessages: + msg13964
2024-02-22 16:46:19adminsetmessages: + msg13963
2023-10-18 00:00:00admincreate