21 template<
typename Mapping>
24 static_assert(Mapping::ArrayExtents::rank == 1,
"llama::Vector only supports 1D mappings");
26 using ViewType = decltype(allocViewUninitialized<Mapping>());
31 using size_type =
typename Mapping::ArrayExtents::value_type;
35 template<
typename RecordRef = One<RecordDim>>
43 template<
typename Iterator>
46 if constexpr(std::is_same_v<
47 typename std::iterator_traits<Iterator>::iterator_category,
48 std::random_access_iterator_tag>)
49 reserve(std::distance(first, last));
50 for(; first != last; ++first)
77 assert(
false &&
"Index out of range");
79 throw std::out_of_range{
"Index " + std::to_string(i) +
"out of range [0:" + std::to_string(m_size) +
"["};
120 return m_view(m_size - 1);
125 return m_view(m_size - 1);
130 return m_view.begin();
135 return m_view.begin();
140 return std::as_const(m_view).begin();
145 return m_view.begin();
150 return m_view.begin() + m_size;
155 return m_view.begin() + m_size;
160 return std::as_const(m_view).begin() + m_size;
165 return m_view.begin() + m_size;
186 return m_view.extents()[0];
192 changeCapacity(m_size);
203 const auto i = pos -
begin();
206 std::copy_backward(pos,
end(),
end() + 1);
207 m_view[i] = std::forward<T>(t);
231 if(
const auto cap =
capacity(); m_size == cap)
232 reserve(std::max(cap + cap / 2, m_size + 1));
234 m_view[m_size++] = std::forward<T>(t);
245 template<
typename RecordRef = One<RecordDim>>
249 for(
size_type i = m_size; i < count; i++)
256 if(a.m_size != b.m_size)
258 return std::equal(a.begin(), a.end(), b.begin());
268 return std::lexicographical_compare(a.begin(), a.end(), b.begin(), b.end());
298 swap(m_view, newView);
304 swap(m_view, other.m_view);
305 swap(m_size, other.m_size);
#define LLAMA_FN_HOST_ACC_INLINE
ArrayExtents(Args...) -> ArrayExtents< typename internal::IndexTypeFromArgs< std::size_t, Args... >::type,(Args{}, dyn)... >
void copy(const View< SrcMapping, SrcBlob > &srcView, View< DstMapping, DstBlob > &dstView, std::size_t threadId=0, std::size_t threadCount=1)
auto swap(RecordRef< ViewA, BoundRecordDimA, OwnViewA > &a, RecordRef< ViewB, BoundRecordDimB, OwnViewB > &b) noexcept -> std::enable_if_t< std::is_same_v< typename RecordRef< ViewA, BoundRecordDimA, OwnViewA >::AccessibleRecordDim, typename RecordRef< ViewB, BoundRecordDimB, OwnViewB >::AccessibleRecordDim >>
Vector(size_type count, const RecordRef &value={})
auto operator=(Vector &&other) noexcept -> Vector &
auto back() -> decltype(auto)
friend auto operator<=(const Vector &a, const Vector &b) -> bool
auto end() -> decltype(auto)
friend auto operator<(const Vector &a, const Vector &b) -> bool
auto at(size_type i) -> decltype(auto)
Vector(Iterator first, Iterator last)
auto back() const -> decltype(auto)
auto operator[](size_type i) const -> decltype(auto)
auto operator[](size_type i) -> decltype(auto)
auto erase(iterator pos) -> iterator
typename iterator::value_type value_type
auto begin() const -> decltype(auto)
auto cend() const -> decltype(auto)
auto front() const -> decltype(auto)
auto end() const -> decltype(auto)
decltype(std::declval< ViewType >().begin()) iterator
auto cbegin() -> decltype(auto)
auto empty() const -> bool
friend void swap(Vector &a, Vector &b) noexcept
auto size() const -> size_type
auto insert(iterator pos, T &&t) -> iterator
auto operator=(const Vector &other) -> Vector &=default
friend auto operator>(const Vector &a, const Vector &b) -> bool
typename Mapping::RecordDim RecordDim
friend auto operator!=(const Vector &a, const Vector &b) -> bool
void resize(size_type count, const RecordRef &value={})
friend auto operator==(const Vector &a, const Vector &b) -> bool
auto cbegin() const -> decltype(auto)
auto capacity() const -> size_type
auto cend() -> decltype(auto)
friend auto operator>=(const Vector &a, const Vector &b) -> bool
auto front() -> decltype(auto)
void reserve(size_type cap)
Vector(const Vector &other)=default
typename Mapping::ArrayExtents::value_type size_type
decltype(allocViewUninitialized< Mapping >()) ViewType
auto begin() -> decltype(auto)
auto at(size_type i) const -> decltype(auto)
Vector(Vector &&other) noexcept