26 Numerics library [numerics]

26.6 Numeric arrays [numarray]

26.6.4 Class slice [class.slice]

26.6.4.1 Class slice overview [class.slice.overview]

namespace std {
  class slice {
  public:
    slice();
    slice(size_t, size_t, size_t);

    size_t start() const;
    size_t size() const;
    size_t stride() const;
  };
}

The slice class represents a BLAS-like slice from an array. Such a slice is specified by a starting index, a length, and a stride.288

BLAS stands for Basic Linear Algebra Subprograms. C++ programs may instantiate this class. See, for example, Dongarra, Du Croz, Duff, and Hammerling: A set of Level 3 Basic Linear Algebra Subprograms; Technical Report MCS-P1-0888, Argonne National Laboratory (USA), Mathematics and Computer Science Division, August, 1988.

26.6.4.2 slice constructors [cons.slice]

slice(); slice(size_t start, size_t length, size_t stride); slice(const slice&);

The default constructor is equivalent to slice(0, 0, 0). A default constructor is provided only to permit the declaration of arrays of slices. The constructor with arguments for a slice takes a start, length, and stride parameter.

Example: slice(3, 8, 2) constructs a slice which selects elements 3, 5, 7, ... 17 from an array.  — end example ]

26.6.4.3 slice access functions [slice.access]

size_t start() const; size_t size() const; size_t stride() const;

Returns: The start, length, or stride specified by a slice object.

Complexity: Constant time.