This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.
std::atan2
and std::pow
overloads that take two std::valarray
parameters
should require the arguments to have the same lengthSection: 29.6.3.3 [valarray.transcend] Status: New Submitter: Jiang An Opened: 2023-07-28 Last modified: 2023-10-30
Priority: 4
View all issues with New status.
Discussion:
All binary operation between std::valarray
s expect them to have the same length.
But std::atan2
and std::pow
lack such Preconditions.
[2023-10-30; Reflector poll]
Set priority to 4 after reflector poll. "Also need to say what those functions return." "Paragraph 1 needs a correction for the functions that takes two operands." "And those are arguments not operands."
Proposed resolution:
This wording is relative to N4950.
Modify 29.6.3.3 [valarray.transcend] as indicated:
template<class T> valarray<T> abs (const valarray<T>&); template<class T> valarray<T> acos (const valarray<T>&); template<class T> valarray<T> asin (const valarray<T>&); template<class T> valarray<T> atan (const valarray<T>&); template<class T> valarray<T> atan2(const valarray<T>&, const valarray<T>&); template<class T> valarray<T> atan2(const valarray<T>&, const typename valarray<T>::value_type&); template<class T> valarray<T> atan2(const typename valarray<T>::value_type&, const valarray<T>&); template<class T> valarray<T> cos (const valarray<T>&); template<class T> valarray<T> cosh (const valarray<T>&); template<class T> valarray<T> exp (const valarray<T>&); template<class T> valarray<T> log (const valarray<T>&); template<class T> valarray<T> log10(const valarray<T>&); template<class T> valarray<T> pow (const valarray<T>&, const valarray<T>&); template<class T> valarray<T> pow (const valarray<T>&, const typename valarray<T>::value_type&); template<class T> valarray<T> pow (const typename valarray<T>::value_type&, const valarray<T>&); template<class T> valarray<T> sin (const valarray<T>&); template<class T> valarray<T> sinh (const valarray<T>&); template<class T> valarray<T> sqrt (const valarray<T>&); template<class T> valarray<T> tan (const valarray<T>&); template<class T> valarray<T> tanh (const valarray<T>&);-1- Mandates: A unique function with the indicated name can be applied (unqualified) to an operand of type
-?- Preconditions: ForT
. This function returns a value of typeT
or which can be unambiguously implicitly converted to typeT
.atan2
andpow
overloads that take twovalarray
parameters, the corresponding array arguments have the same length.