5#include "../platform/constexpr.hpp"
6#include "../platform/attributes.hpp"
24 using start_type = std::ptrdiff_t;
25 using count_type = std::size_t;
26 using step_type = std::ptrdiff_t;
92 lhs.get_start() ==
rhs.get_start() &&
93 lhs.get_count() ==
rhs.get_count() &&
94 lhs.get_step() ==
rhs.get_step();
97 friend REXLIB_CONSTEXPR
103 template <
typename T>
104 friend std::basic_ostream<T>&
105 operator<<(std::basic_ostream<T> &os,
const slice &s)
108 os <<
"slice(" << s.get_start()
109 <<
", " << s.get_count()
110 <<
", " << s.get_step() <<
")";
Container for multidimensional numeric data.
Definition array.hpp:31
Class representing an slice of an array.
Definition slice.hpp:22
REXLIB_CONSTEXPR void set_step(step_type step) noexcept
Set the step.
REXLIB_CONSTEXPR const step_type & get_step() const noexcept
Get the step.
REXLIB_CONSTEXPR const start_type & get_start() const noexcept
Get the starting index.
REXLIB_CONSTEXPR void set_start(start_type start) noexcept
Set the starting index.
REXLIB_CONSTEXPR const count_type & get_count() const noexcept
Get the element count.
REXLIB_CONSTEXPR slice(start_type start, count_type count, step_type step) noexcept
Constructor.
REXLIB_CONSTEXPR void set_count(count_type count) noexcept
Set the index element count.
Arrays, the operations on them and the devices that run those operations.
Definition cpu_device.hpp:10
REXLIB_CONSTEXPR slice odd() noexcept
Construct an slice containing odd positions in the axis.
REXLIB_CONSTEXPR slice make_slice(std::size_t count) noexcept
Create an slice using its count value.
REXLIB_CONSTEXPR std::size_t end() noexcept
Get the value representing the end of an array to be used as count.
REXLIB_CONSTEXPR slice all() noexcept
Construct an slice containing all positions in the axis.
slice sanitize_slice(const slice &slice, std::size_t extent)
Sanitize a slice to ensure it is valid and within bounds for a given extent.
REXLIB_CONSTEXPR slice even() noexcept
Construct an slice containing even positions in the axis.