GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||
GeezerVison is showing cplusplus.com — std::valarray::cshift Reference
valarray
public member function
<valarray>
std::valarray::cshiftvalarray cshift (int n) const; Circularly shift elements
The valarray returned has the same length as *this.By cyclically shifting (rotating) an array, the I-th element in the resulting valarray corresponds to the element with position (I+n)%size() in the original valarray. Unlike valarray::shift, the valarray returned by cshift does not initialize new elements with their default constructor to fill the last n elements in *this (or the first -n elements if n is negative). Instead, it uses the first (or last) elements of *this.Parameters
Return valueA new valarray object with the elements of*this rotated n spaces left.Example
Output:
ComplexityDepends on library implementation.Iterator validityNo changes: Valid iterators, references and sub-arrays of the source valarray keep their validity.Data racesBoth the valarray and its elements are accessed.Exception safetyIf the function implementation constructs or assigns to elements, and any such operation throws an exception, it causes undefined behavior.If the function needs to allocate internal storage and fails, it may throw an exception (such as bad_alloc), although this is not mandated. See also
Home page | Privacy policy
© cplusplus.com, 2000-2026 - All rights reserved - v3.3.4s Spotted an error? contact us | |||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |