15 #ifndef CORE_CONTAINER_INLINE_VECTOR_H_
16 #define CORE_CONTAINER_INLINE_VECTOR_H_
33 #if (!defined(__CLING__) || defined(__ROOTCLING__)) && defined(USE_DICT)
35 #include "TClassTable.h"
48 template <
typename T, u
int16_t N>
51 template <
typename TT,
typename TIV>
175 other.heap_data_ =
nullptr;
224 assert(
size_ != std::numeric_limits<uint16_t>::max() &&
225 "Maximum number of elements exceeded");
229 uint16_t new_capacity =
static_cast<uint16_t
>(tmp);
230 if (tmp > std::numeric_limits<uint16_t>::max()) {
231 new_capacity = std::numeric_limits<uint16_t>::max();
241 auto idx = it.index_;
244 "InlineVector::erase",
245 "You tried to erase an element that is outside the InlineVector.");
247 }
else if (idx ==
size_ - 1) {
254 for (uint16_t i = it.index_; i <
size_ - 1; i++) {
255 (*this)[i] = (*this)[i + 1];
262 std::vector<T> std_vector(
size_);
263 for (uint16_t i = 0; i <
size_; i++) {
264 std_vector[i] = (*this)[i];
270 if (
this != &other) {
288 if (
this != &other) {
289 data_ = std::move(other.data_);
293 other.heap_data_ =
nullptr;
294 other.heap_capacity_ = 0;
320 for (uint16_t i = 0; i < std::min(
size_, N); i++) {
327 for (uint16_t i = 0; i <
HeapSize(); i++) {
338 for (uint16_t i = 0; i < other.
size_; i++) {
339 out << other[i] <<
", ";
368 #if (!defined(__CLING__) || defined(__ROOTCLING__)) && defined(USE_DICT)
370 template <
typename T, u
int16_t N>
372 if (R__b.IsReading()) {
379 VectorTypeWrapper<T> vw;
381 for (uint16_t i = 0; i < size_; i++) {
382 vw.vector_[i] = (*this)[i];
384 R__b.WriteClassBuffer(VectorTypeWrapper<T>::Class(), &vw);
void push_back(const T &element)
InlineVector(TRootIOCtor *io_ctor)
iterator erase(const iterator &it)
static constexpr float kGrowFactor
typename InlineVector::template Iterator< const T, const InlineVector > const_iterator
const_iterator begin() const
std::vector< T > make_std_vector() const
T & operator[](uint16_t index)
InlineVector(const InlineVector< T, N > &other)
void reserve(uint16_t new_capacity)
typename InlineVector::template Iterator< T, InlineVector > iterator
bool operator==(const InlineVector< T, N > &other) const
uint16_t HeapSize() const
BDM_CLASS_DEF_NV(InlineVector, 2)
friend std::ostream & operator<<(std::ostream &out, const InlineVector< T, N > &other)
const_iterator end() const
uint16_t size() const
returns the number of elements in this container
const T & operator[](uint16_t index) const
InlineVector< T, N > & operator=(const InlineVector< T, N > &other)
InlineVector< T, N > & operator=(InlineVector< T, N > &&other) noexcept
InlineVector(InlineVector< T, N > &&other) noexcept
uint16_t capacity() const
static void Fatal(const std::string &location, const Args &... parts)
Prints fatal error message.
Iterator operator-(uint16_t i)
Iterator & operator-=(uint16_t i)
Iterator & operator-=(const Iterator &rhs)
Iterator & operator+=(const Iterator &rhs)
Iterator operator+(uint16_t i)
Iterator & operator+=(uint16_t i)
Iterator & operator=(const Iterator &other)
Iterator(uint16_t index, TIV *iv)
bool operator==(const Iterator &other) const
bool operator!=(const Iterator &other) const
Iterator operator+(const Iterator &rhs)
Iterator operator-(const Iterator &rhs)
Iterator(const Iterator &other)