+ void resize(size_t s) {
+
+ /* Nothing to do if the size isn't changing: */
+ if(s == m_size) return;
+
+ /* Destroy the current array contents: */
+ this->destroy();
+
+ /* Set the new size if non-zero: */
+ if(s > 0) {
+ value_type* data = m_alloc.allocate(s);
+ for(size_t i = 0; i < s; ++ i)
+ m_alloc.construct(&data[i], value_type());
+
+ /* Success, save s and data: */
+ m_size = s;
+ m_data = data;
+ }
+ }
+
+ /** Copy the source array. The previous contents are destroyed before
+ * reallocating the array. If other == *this, nothing happens.
+ */
+ void copy(const dynamic_1D& other) {
+
+ /* Nothing to do if it's the same array: */
+ if(&other == this) return;
+
+ /* Destroy the current array contents: */
+ this->destroy();
+
+ /* Set the new size if non-zero: */
+ size_t s = other.size();
+ if(s > 0) {
+ value_type* data = m_alloc.allocate(s);
+ for(size_t i = 0; i < s; ++ i)
+ m_alloc.construct(&data[i], other[i]);
+
+ /* Success, so save the new array and the size: */
+ m_size = s;
+ m_data = data;
+ }
+ }