Title
Some free functions don't automatically work for program-defined std::complex<NonFloatingPoint>
Status
new
Section
[complex.numbers]
Submitter
Jiang An

Created on 2024-09-29.00:00:00 last changed 1 month ago

Messages

Date: 2024-09-29.00:00:00

std::complex<NonFloatingPoint> is possibly a program-defined specialization and thus instantiation of such a specialization can have determined effect. However, it's improbable for implementations to ensure that some free functions, e.g. abs, sin, exp, work for such a specialization.

Moreover, P2819R2 made all std::complex specializations tuple-like types, despite that std::get overloads need to touch implementation details and thus don't work for program-defined specializations.

It seems better to make only complex<floating-point> tuple-like types, and add Constraints to some free functions that can't be guaranteed to work to only accept cases where T is a cv-unqualified floating-point type. However, it's unclear to me how to handle cases where the implementation intentionally supports complex<X> (where X is not a program-defined type) as extension, and whether Mandates should be used.

History
Date User Action Args
2024-09-29 00:00:00admincreate