37 ::operator
delete(start);
69 const void* first,
const size_t n);
81 const size_t n = position - start;
82 if (finish != end_of_storage && position == finish) {
85 insert_aux(position, x);
93 if (finish != end_of_storage)
96 insert_aux(finish, x);
111 template<>
inline void 115 if (positions.
size() == 0)
120 while (pos != lastpos)
121 operator[](*pos++) = *val++;
127 if (positions.
size() != values.
size())
128 throw BCP_fatal_error(
"BCP_vec::update() called with unequal sizes.\n");
130 unchecked_update(positions, values);
143 const size_t len = last - first;
144 std::memmove(start, first, len *
sizeof(
short));
145 finish = start + len;
166 if (position + 1 != finish)
167 std::memmove(position, position + 1, ((finish-position) - 1) *
sizeof(
short));
173 if (first != last && last != finish)
174 std::memmove(first, last, (finish - last) *
sizeof(
short));
175 finish -= (last - first);
void BCP_vec_sanity_check(BCP_vec< int >::const_iterator firstpos, BCP_vec< int >::const_iterator lastpos, const int maxsize)
A helper function to test whether a set positions is sane for a vector.
void unchecked_update(const BCP_vec< int > &positions, const BCP_vec< T > &values)
Same as the previous method but without sanity checks.
void assign(const void *x, const size_t num)
Copy num entries of type T starting at the memory location x into the object.
void pop_back()
Delete the last entry.
void erase(iterator pos)
Erase the entry pointed to by pos.
Currently there isn't any error handling in BCP.
void keep(iterator pos)
Keep only the entry pointed to by pos.
BCP_vec()
The default constructor initializes the data members as 0 pointers.
void push_back(const_reference x)
Append x to the end of the vector.
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...
void unchecked_push_back(const_reference x)
Append x to the end of the vector.
void update(const BCP_vec< int > &positions, const BCP_vec< T > &values)
Update those entries listed in positions to the given values.
void reserve(const size_t n)
Reallocate the object to make space for n entries.
iterator end()
Return an iterator to the end of the object.
void deallocate()
Destroy the entries in the vector and free the memory allocated for the vector.
size_t size() const
Return the current number of entries.
The class BCP_vec serves the same purpose as the vector class in the standard template library...
void insert_aux(iterator position, const_reference x)
insert x into the given position in the vector.
iterator begin()
Return an iterator to the beginning of the object.
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.