80 data_ = inline_buffer_;
89 template<
typename U, BLI_ENABLE_IF((std::is_convertible_v<U, T>))>
93 data_ = this->get_buffer_for_size(size);
101 template<
typename U, BLI_ENABLE_IF((std::is_convertible_v<U, T>))>
122 data_ = this->get_buffer_for_size(size);
135 data_ = this->get_buffer_for_size(size);
156 data_ = this->get_buffer_for_size(size);
162 Array(
Array &&other)
noexcept(std::is_nothrow_move_constructible_v<T>)
165 if (other.data_ == other.inline_buffer_) {
168 const int64_t relocate_num = (InlineBufferCapacity > 0) ? other.size_ : 0;
176 other.data_ = other.inline_buffer_;
183 this->deallocate_if_not_inline(data_);
220 template<
typename U, BLI_ENABLE_IF((is_span_convertible_po
inter_v<T, U>))>
226 template<
typename U, BLI_ENABLE_IF((is_span_convertible_po
inter_v<T, U>))>
261 void fill(
const T &value)
const
289 return *(data_ + size_ - 1 - n);
295 return *(data_ + size_ - 1 - n);
316 return data_ + size_;
325 return data_ + size_;
330 return std::reverse_iterator<T *>(this->
end());
332 std::reverse_iterator<T *>
rend()
334 return std::reverse_iterator<T *>(this->
begin());
337 std::reverse_iterator<const T *>
rbegin()
const
339 return std::reverse_iterator<T *>(this->
end());
341 std::reverse_iterator<const T *>
rend()
const
343 return std::reverse_iterator<T *>(this->
begin());
381 return InlineBufferCapacity;
396 if (new_size <= old_size) {
400 T *new_data = this->get_buffer_for_size(new_size);
405 this->deallocate_if_not_inline(new_data);
408 this->deallocate_if_not_inline(data_);
416 T *get_buffer_for_size(
int64_t size)
418 if (size <= InlineBufferCapacity) {
419 return inline_buffer_;
422 return this->allocate(size);
428 return static_cast<T *
>(allocator_.allocate(
size_t(size) *
sizeof(T),
alignof(T), AT));
431 void deallocate_if_not_inline(T *
ptr)
433 if (
ptr != inline_buffer_) {
434 allocator_.deallocate(
ptr);
#define BLI_NO_UNIQUE_ADDRESS
Array(Array &&other) noexcept(std::is_nothrow_move_constructible_v< T >)
Array(Span< U > values, Allocator allocator={})
Array(NoExceptConstructor, Allocator allocator={}) noexcept
std::reverse_iterator< T * > rbegin()
Span< T > as_span() const
MutableSpan< T > as_mutable_span()
const T & operator[](int64_t index) const
const T & last(const int64_t n=0) const
Array(Allocator allocator={}) noexcept
static int64_t inline_buffer_capacity()
T & operator[](int64_t index)
Array(int64_t size, const T &value, Allocator allocator={})
std::reverse_iterator< T * > rend()
IndexRange index_range() const
const Allocator & allocator() const
std::reverse_iterator< const T * > rend() const
T & last(const int64_t n=0)
std::reverse_iterator< const T * > rbegin() const
Array(int64_t size, NoInitialization, Allocator allocator={})
void fill(const T &value) const
Array(const std::initializer_list< U > &values, Allocator allocator={})
const T & const_reference
void reinitialize(const int64_t new_size)
Array & operator=(const Array &other)
void clear_without_destruct()
Array(int64_t size, Allocator allocator={})
Array & operator=(Array &&other) noexcept(std::is_nothrow_move_constructible_v< T >)
Array(const Array &other)
Array(const std::initializer_list< T > &values, Allocator allocator={})
void default_construct_n(T *ptr, int64_t n)
void initialized_fill_n(T *dst, int64_t n, const T &value)
Container & copy_assign_container(Container &dst, const Container &src)
Container & move_assign_container(Container &dst, Container &&src) noexcept(std::is_nothrow_move_constructible_v< Container >)
constexpr int64_t default_inline_buffer_capacity(size_t element_size)
void uninitialized_fill_n(T *dst, int64_t n, const T &value)
void uninitialized_relocate_n(T *src, int64_t n, T *dst)
void uninitialized_convert_n(const From *src, int64_t n, To *dst)
void destruct_n(T *ptr, int64_t n)