1 #ifndef VIENNACL_SLICE_HPP_
2 #define VIENNACL_SLICE_HPP_
37 template <
typename SizeType ,
38 typename DistanceType >
50 difference_type stride_arg,
51 size_type size_arg) : start_(start_index), stride_(stride_arg), size_(size_arg) {}
54 size_type
start()
const {
return start_; }
55 difference_type
stride()
const {
return stride_; }
56 size_type
size()
const {
return size_; }
61 return start_ + i * stride_;
65 bool operator==(
const basic_slice & s)
const {
return (start_ == s.start_) && (stride_ == s.stride_) && (size_ == s.size_); }
70 difference_type stride_;
const_reference operator()(size_type i) const
Definition: slice.hpp:58
difference_type stride() const
Definition: slice.hpp:55
basic_slice()
Definition: slice.hpp:48
size_type value_type
Definition: slice.hpp:44
const_reference reference
Definition: slice.hpp:46
value_type const_reference
Definition: slice.hpp:45
This file provides the forward declarations for the main types used within ViennaCL.
const_reference operator[](size_type i) const
Definition: slice.hpp:63
Main namespace in ViennaCL. Holds all the basic types such as vector, matrix, etc. and defines operations upon them.
Definition: cpu_ram.hpp:29
bool operator!=(const basic_slice &s) const
Definition: slice.hpp:66
bool operator==(const basic_slice &s) const
Definition: slice.hpp:65
SizeType size_type
Definition: slice.hpp:42
basic_slice(size_type start_index, difference_type stride_arg, size_type size_arg)
Definition: slice.hpp:49
size_type size() const
Definition: slice.hpp:56
DistanceType difference_type
Definition: slice.hpp:43
size_type start() const
Definition: slice.hpp:54
A slice class that refers to an interval [start, stop), where 'start' is included, and 'stop' is excluded.
Definition: forwards.h:344