BioDynaMo
v1.05.120-25dc9790
|
Go to the documentation of this file.
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>
371 inline void InlineVector<T, N>::Streamer(TBuffer& R__b) {
372 if (R__b.IsReading()) {
373 VectorTypeWrapper<T> vw;
374 R__b.ReadClassBuffer(VectorTypeWrapper<T>::Class(), &vw);
375 for (
auto ve : vw.vector_) {
379 VectorTypeWrapper<T> vw;
380 vw.vector_.resize(size_);
381 for (uint16_t i = 0; i < size_; i++) {
382 vw.vector_[i] = (*this)[i];
384 R__b.WriteClassBuffer(VectorTypeWrapper<T>::Class(), &vw);
388 #endif // !defined(__CLING__) || defined(__ROOTCLING__)
392 #endif // CORE_CONTAINER_INLINE_VECTOR_H_
Iterator(const Iterator &other)
Iterator(uint16_t index, TIV *iv)
bool operator!=(const Iterator &other) const
static constexpr float kGrowFactor
Iterator operator+(const Iterator &rhs)
Iterator & operator+=(uint16_t i)
Iterator operator-(uint16_t i)
Iterator & operator+=(const Iterator &rhs)
uint16_t HeapSize() const
T & operator[](uint16_t index)
Iterator & operator=(const Iterator &other)
bool operator==(const Iterator &other) const
void reserve(uint16_t new_capacity)
InlineVector(InlineVector< T, N > &&other) noexcept
InlineVector(const InlineVector< T, N > &other)
InlineVector< T, N > & operator=(InlineVector< T, N > &&other) noexcept
const_iterator end() const
InlineVector< T, N > & operator=(const InlineVector< T, N > &other)
uint16_t size() const
returns the number of elements in this container
uint16_t capacity() const
static void Fatal(const std::string &location, const Args &... parts)
Prints fatal error message.
iterator erase(const iterator &it)
Iterator & operator-=(const Iterator &rhs)
typename InlineVector::template Iterator< bdm::Behavior *, InlineVector > iterator
BDM_CLASS_DEF_NV(InlineVector, 2)
bool operator==(const InlineVector< T, N > &other) const
void push_back(const T &element)
const T & operator[](uint16_t index) const
std::vector< T > make_std_vector() const
Iterator operator-(const Iterator &rhs)
Iterator operator+(uint16_t i)
friend std::ostream & operator<<(std::ostream &out, const InlineVector< T, N > &other)
const_iterator begin() const
typename InlineVector::template Iterator< const bdm::Behavior *, const InlineVector > const_iterator
Iterator & operator-=(uint16_t i)
InlineVector(TRootIOCtor *io_ctor)