Created on 2007-01-10.00:00:00 last changed 172 months ago
Rationale:
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.
Proposed resolution:
Change [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.that is a circular shift of *this. If element zero is taken as the leftmost element, a non-negative value of n shifts the elements circularly left n places and a negative value of n shifts the elements circularly right -n places.
I would respectfully request an issue be opened with the intention to clarify the wording for size() == 0 for cshift.
History | |||
---|---|---|---|
Date | User | Action | Args |
2010-10-21 18:28:33 | admin | set | messages: + msg3234 |
2010-10-21 18:28:33 | admin | set | messages: + msg3233 |
2007-01-10 00:00:00 | admin | create |