From b1a98974a468c109e4a2d33dde3dfa3448cf5053 Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Fri, 8 Jan 2016 23:16:40 +0100 Subject: [PATCH] Update documentation --- include/deal.II/base/aligned_vector.h | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/include/deal.II/base/aligned_vector.h b/include/deal.II/base/aligned_vector.h index 5c81dc0138..901a2059c9 100644 --- a/include/deal.II/base/aligned_vector.h +++ b/include/deal.II/base/aligned_vector.h @@ -290,10 +290,13 @@ namespace internal public: /** * Constructor. Issues a parallel call if there are sufficiently many - * elements, otherwise work in serial. Copies the data from source to - * destination and then calls destructor on the source. If the optional - * argument copy_source is set to true, the source is left untouched - * instead. + * elements, otherwise works in serial. Copies the data from the half-open + * interval between @p source_begin and @p source_end to array starting at + * @p destination (by calling the copy constructor with placement new). If + * copy_source is set to @p true, the elements from the source array are + * simply copied. If it is set to @p false, the data is moved between the + * two arrays by invoking the destructor on the source range (preparing + * for a subsequent call to free). */ AlignedVectorMove (T *source_begin, T *source_end, @@ -329,7 +332,8 @@ namespace internal else if (copy_source_ == false) for (std::size_t i=begin; i::AlignedVector (const AlignedVector &vec) _end_data (0), _end_allocated (0) { - // do not invalidate old data + // copy the data from vec resize_fast (vec._end_data - vec._data); internal::AlignedVectorMove (vec._data, vec._end_data, _data, true); } @@ -498,7 +503,9 @@ AlignedVector::resize_fast (const size_type size_in) const size_type old_size = size(); if (std_cxx11::is_trivial::value == false && size_in < old_size) { - // call destructor on fields that are released + // call destructor on fields that are released. doing it backward + // releases the elements in reverse order as compared to how they were + // created while (_end_data != _data+size_in) (--_end_data)->~T(); } @@ -522,7 +529,9 @@ AlignedVector::resize (const size_type size_in, const size_type old_size = size(); if (std_cxx11::is_trivial::value == false && size_in < old_size) { - // call destructor on fields that are released + // call destructor on fields that are released. doing it backward + // releases the elements in reverse order as compared to how they were + // created while (_end_data != _data+size_in) (--_end_data)->~T(); } -- 2.39.5