87 template<
typename T>
class Span {
98 const T *data_ =
nullptr;
112 template<
typename U,
typename std::enable_if_t<is_span_convertible_po
inter_v<U, T>> * =
nullptr>
129 constexpr
Span(
const std::initializer_list<T> &list)
147 template<
typename U,
typename std::enable_if_t<is_span_convertible_po
inter_v<U, T>> * =
nullptr>
176 const int64_t new_size = std::max<int64_t>(0, size_ - n);
187 const int64_t new_size = std::max<int64_t>(0, size_ - n);
198 const int64_t new_size = std::min<int64_t>(size_, n);
209 const int64_t new_size = std::min<int64_t>(size_, n);
210 return Span(
data_ + size_ - new_size, new_size);
228 return data_ + size_;
231 constexpr std::reverse_iterator<const T *>
rbegin()
const
233 return std::reverse_iterator<const T *>(this->
end());
235 constexpr std::reverse_iterator<const T *>
rend()
const
237 return std::reverse_iterator<const T *>(this->
begin());
272 return sizeof(
T) * size_;
295 return (this->
begin() <= ptr) && (
ptr < this->
end());
330 return data_[size_ - 1];
339 if (index < size_ && index >= 0) {
355 for (
int64_t i = 0; i < size_; i++) {
356 const T &value =
data_[i];
357 for (
int64_t j = i + 1; j < size_; j++) {
358 if (value ==
data_[j]) {
377 for (
int64_t i = 0; i < size_; i++) {
378 const T &value =
data_[i];
402 for (
int64_t i = 0; i < size_; i++) {
403 if (
data_[i] == search_value) {
424 BLI_assert((size_ *
sizeof(
T)) %
sizeof(NewT) == 0);
425 int64_t new_size = size_ *
sizeof(
T) /
sizeof(NewT);
431 if (
a.size() != b.
size()) {
434 return std::equal(
a.begin(),
a.end(), b.
begin());
446 template<
typename Pr
intLineF>
void print_as_lines(std::string name, PrintLineF print_line)
const
448 std::cout <<
"Span: " << name <<
" \tSize:" << size_ <<
'\n';
449 for (
const T &value : *
this) {
462 this->
print_as_lines(name, [](
const T &value) { std::cout << value; });
495 template<std::
size_t N>
504 template<
typename U,
typename std::enable_if_t<is_span_convertible_po
inter_v<U, T>> * =
nullptr>
515 template<
typename U,
typename std::enable_if_t<is_span_convertible_po
inter_v<T, U>> * =
nullptr>
572 return data_ + size_;
575 constexpr std::reverse_iterator<T *>
rbegin()
const
577 return std::reverse_iterator<T *>(this->
end());
579 constexpr std::reverse_iterator<T *>
rend()
const
581 return std::reverse_iterator<T *>(this->
begin());
609 const int64_t new_size = std::max<int64_t>(0, size_ - n);
620 const int64_t new_size = std::max<int64_t>(0, size_ - n);
631 const int64_t new_size = std::min<int64_t>(size_, n);
642 const int64_t new_size = std::min<int64_t>(size_, n);
671 return data_[size_ - 1];
706 BLI_assert((size_ *
sizeof(
T)) %
sizeof(NewT) == 0);
707 int64_t new_size = size_ *
sizeof(
T) /
sizeof(NewT);
725 template<
typename T1,
typename T2,
typename T3>
#define UNUSED_VARS_NDEBUG(...)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble v1
ATTR_WARN_UNUSED_RESULT const void * element
ATTR_WARN_UNUSED_RESULT const BMVert * v2
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
constexpr int64_t size() const
constexpr int64_t start() const
constexpr MutableSpan()=default
constexpr int64_t size() const
constexpr T * end() const
constexpr T & operator[](const int64_t index) const
constexpr void fill(const T &value)
const T & const_reference
constexpr MutableSpan< NewT > cast() const
constexpr MutableSpan slice(const int64_t start, const int64_t size) const
constexpr bool is_empty() const
constexpr MutableSpan take_back(const int64_t n) const
constexpr MutableSpan drop_back(const int64_t n) const
constexpr MutableSpan drop_front(const int64_t n) const
constexpr void fill_indices(Span< int64_t > indices, const T &value)
constexpr MutableSpan(std::array< T, N > &array)
constexpr void copy_from(Span< T > values)
constexpr std::reverse_iterator< T * > rend() const
constexpr std::reverse_iterator< T * > rbegin() const
constexpr int64_t count(const T &value) const
constexpr Span< T > as_span() const
constexpr MutableSpan(std::vector< T > &vector)
constexpr T * begin() const
constexpr IndexRange index_range() const
constexpr T * data() const
constexpr MutableSpan(T *start, const int64_t size)
constexpr MutableSpan(MutableSpan< U > span)
constexpr T & last() const
constexpr MutableSpan take_front(const int64_t n) const
friend bool operator!=(const Span< T > a, const Span< T > b)
constexpr std::reverse_iterator< const T * > rend() const
constexpr Span drop_front(int64_t n) const
constexpr std::reverse_iterator< const T * > rbegin() const
constexpr Span slice(int64_t start, int64_t size) const
constexpr Span(Span< U > span)
constexpr int64_t size_in_bytes() const
constexpr const T & operator[](int64_t index) const
void print_as_lines(std::string name) const
constexpr Span take_back(int64_t n) const
constexpr int64_t first_index_try(const T &search_value) const
friend bool operator==(const Span< T > a, const Span< T > b)
void print_as_lines(std::string name, PrintLineF print_line) const
constexpr Span slice(IndexRange range) const
constexpr const T * data() const
constexpr const T & last() const
constexpr Span(const std::vector< T > &vector)
constexpr Span(const T *start, int64_t size)
constexpr Span drop_back(int64_t n) const
constexpr T get(int64_t index, const T &fallback) const
constexpr int64_t count(const T &value) const
constexpr bool has_duplicates__linear_search() const
constexpr const T & first() const
constexpr int64_t first_index(const T &search_value) const
constexpr Span(const U *start, int64_t size)
constexpr int64_t size() const
constexpr Span< NewT > cast() const
constexpr Span(const std::array< T, N > &array)
constexpr IndexRange index_range() const
constexpr Span(const std::initializer_list< T > &list)
constexpr const T * end() const
const T & const_reference
constexpr Span take_front(int64_t n) const
constexpr const T * begin() const
constexpr bool is_empty() const
constexpr bool contains(const T &value) const
constexpr bool contains_ptr(const T *ptr) const
constexpr bool intersects__linear_search(Span other) const
constexpr void assert_same_size(const T1 &v1, const T2 &v2)
void initialized_fill_n(T *dst, int64_t n, const T &value)
void initialized_copy_n(const T *src, int64_t n, T *dst)