BioDynaMo
v1.05.120-25dc9790
|
Go to the documentation of this file.
15 #ifndef CORE_CONTAINER_PARALLEL_RESIZE_VECTOR_H_
16 #define CORE_CONTAINER_PARALLEL_RESIZE_VECTOR_H_
38 for (
auto& el : init) {
51 #pragma omp parallel for
52 for (std::size_t i = 0; i < other.
size_; i++) {
61 if (
data_ !=
nullptr) {
62 #pragma omp parallel for
63 for (std::size_t i = 0; i <
size_; i++) {
103 T* new_data =
static_cast<T*
>(malloc(new_capacity *
sizeof(T)));
104 if (
data_ !=
nullptr) {
106 #pragma omp parallel for
107 for (std::size_t i = 0; i <
size_; i++) {
108 new (&(new_data[i])) T(
data_[i]);
111 #pragma omp parallel for
112 for (std::size_t i = 0; i <
size_; i++) {
122 void resize(std::size_t new_size,
const T& t = T()) {
128 #pragma omp parallel for
129 for (std::size_t i =
size_; i < new_size; i++) {
130 new (&(
data_[i])) T(t);
133 #pragma omp parallel for
134 for (std::size_t i = new_size; i <
size_; i++) {
141 for (std::size_t i = 0; i <
size_; i++) {
148 if (&other ==
this) {
159 #pragma omp parallel for
160 for (std::size_t i = 0; i <
size_; i++) {
188 #endif // CORE_CONTAINER_PARALLEL_RESIZE_VECTOR_H_
static constexpr float kGrowFactor
ParallelResizeVector(std::initializer_list< T > init)
ParallelResizeVector & operator=(const ParallelResizeVector &other)
void push_back(const T &element)
std::vector with parallel resize
ParallelResizeVector(std::size_t new_size, const T &t=T())
const T & operator[](std::size_t index) const
ParallelResizeVector(const ParallelResizeVector &other)
T & operator[](std::size_t index)
void reserve(std::size_t new_capacity)
BDM_CLASS_DEF(ParallelResizeVector, 1)
virtual ~ParallelResizeVector()
ParallelResizeVector(TRootIOCtor *io_ctor)
void resize(std::size_t new_size, const T &t=T())
const T * data() const noexcept
ParallelResizeVector()=default
std::size_t capacity() const
void swap(ParallelResizeVector &other)