14 const size_t after_pos =
finish - position;
16 memmove(position+1, position, after_pos *
sizeof(
double));
20 const size_t len = (2*
size() + 0x100);
22 const size_t until_pos = position -
start;
23 memmove(tmp, start, until_pos *
sizeof(
double));
24 iterator tmp_finish = tmp + until_pos;
26 memmove(tmp_finish, position, after_pos *
sizeof(
double));
29 finish = start + (until_pos + 1 + after_pos);
37 start(0), finish(0), end_of_storage(0)
48 start(0), finish(0), end_of_storage(0)
50 const size_t len = last - first;
53 memcpy(
start, first, len *
sizeof(
double));
59 start(0), finish(0), end_of_storage(0)
63 memcpy(
start, x, num *
sizeof(
double));
74 const size_t oldsize =
size();
76 memcpy(tmp,
start, oldsize *
sizeof(
double));
87 const size_t x_size = x.
size();
94 memcpy(
start, x.
start, x_size *
sizeof(
double));
110 memcpy(
start, x, num *
sizeof(
double));
115 const void* first,
const size_t n)
120 memmove(position + n, position, (
finish - position) *
sizeof(
double));
121 memcpy(position, first, n *
sizeof(
double));
124 const size_t new_size = (2*
size() +
n);
126 const size_t after_pos =
finish - position;
127 const size_t until_pos = position -
start;
128 memcpy(tmp, start, until_pos *
sizeof(
double));
129 memcpy(tmp + until_pos, first, n *
sizeof(
double));
130 memcpy(tmp + (until_pos + n), position, after_pos *
sizeof(
double));
133 finish = start + (until_pos + n + after_pos);
142 if (first == last)
return;
143 const size_t n = last - first;
145 memmove(position + n, position, (
finish - position) *
sizeof(
double));
146 memcpy(position, first, n *
sizeof(
double));
149 const size_t new_size = (2*
size() +
n);
151 const size_t after_pos =
finish - position;
152 const size_t until_pos = position -
start;
153 memcpy(tmp, start, until_pos *
sizeof(
double));
154 memcpy(tmp + until_pos, first, n *
sizeof(
double));
155 memcpy(tmp + (until_pos + n), position, after_pos *
sizeof(
double));
158 finish = start + (until_pos + n + after_pos);
168 memmove(position + n, position, (
finish - position) *
sizeof(
double));
170 for (
int i = n; i > 0; --i)
173 const size_t new_size = (2*
size() +
n);
175 const size_t after_pos =
finish - position;
176 const size_t until_pos = position -
start;
177 memcpy(tmp, start, until_pos *
sizeof(
double));
178 memcpy(tmp + (until_pos + n), position, after_pos *
sizeof(
double));
181 finish = start + (until_pos + n + after_pos);
183 position = tmp + until_pos;
184 for (
int i = n; i > 0; --i)
void deallocate()
Destroy the entries in the vector and free the memory allocated for the vector.
void insert_aux(iterator position, const_reference x)
insert x into the given position in the vector.
iterator finish
Iterator pointing to right after the last entry in the vector.
const double & const_reference
void reserve(const size_t n)
Reallocate the object to make space for n entries.
size_t capacity() const
Return the capacity of the object (space allocated for this many entries).
BCP_vec< T > & operator=(const BCP_vec< T > &x)
Copy the contents of x into the object and return a reference the the object itself.
iterator end_of_storage
Iterator pointing to right after the last memory location usable by the vector without reallocation...
iterator start
Iterator pointing to the beginning of the memory array where the vector is stored.
BCP_vec()
The default constructor initializes the data members as 0 pointers.
void insert(iterator position, const void *first, const size_t num)
Insert num entries starting from memory location first into the vector from position pos...
size_t size() const
Return the current number of entries.
iterator allocate(size_t len)
allocate raw, uninitialized memory for len entries.
void assign(const void *x, const size_t num)
Copy num entries of type T starting at the memory location x into the object.
const double * const_iterator
void fint fint fint real fint real * x