440. Should std::complex use unqualified transcendentals?

Section: 28.4.8 [complex.transcendentals] Status: NAD Submitter: Matt Austern Opened: 2003-11-05 Last modified: 2016-01-28 10:19:27 UTC

Priority: Not Prioritized

View all other issues in [complex.transcendentals].

View all issues with NAD status.


Operations like pow and exp on complex<T> are typically implemented in terms of operations like sin and cos on T. Should implementations write this as std::sin, or as plain unqualified sin?

The issue, of course, is whether we want to use argument-dependent lookup in the case where T is a user-defined type. This is similar to the issue of valarray transcendentals, as discussed in issue 226.

This issue differs from valarray transcendentals in two important ways. First, "the effect of instantiating the template complex for types other than float, double or long double is unspecified." (28.4.2 [complex.syn]) Second, the standard does not dictate implementation, so there is no guarantee that a particular real math function is used in the implementation of a particular complex function.

Proposed resolution:


If you instantiate std::complex for user-defined types, all bets are off.