This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of CD1 status.
Section: 18.104.22.168 [valarray.members] Status: CD1 Submitter: Gabriel Dos Reis Opened: 2007-01-10 Last modified: 2017-02-03
Priority: Not Prioritized
View all issues with CD1 status.
I would respectfully request an issue be opened with the intention to clarify the wording for size() == 0 for cshift.
Change 22.214.171.124 [valarray.members], paragraph 10:
valarray<T> cshift(int n) const;
This function returns an object of class valarray<T>, of length size(),
each of whose elements I is (*this)[(I + n ) % size()]. Thus, if element zero is taken as the leftmost element, a positive value of n shifts the elements circularly left n places.
We do not believe that there is any real ambiguity about what happens when size() == 0, but we do believe that spelling this out as a C++ expression causes more trouble that it solves. The expression is certainly wrong when n < 0, since the sign of % with negative arguments is implementation defined.
[ Kona (2007) Changed proposed wording, added rationale and set to Review. ]