void Foam::FixedList<T, Size>::swap(FixedList<T, Size>& a) { List_ACCESS(T, (*this), vp); List_ACCESS(T, a, ap); T tmp; List_FOR_ALL((*this), i) tmp = List_ELEM((*this), vp, i); List_ELEM((*this), vp, i) = List_ELEM(a, ap, i); List_ELEM(a, ap, i) = tmp; List_END_FOR_ALL }
void Foam::UList<T>::operator=(const zero) { List_ACCESS(T, (*this), vp); List_FOR_ALL((*this), i) List_ELEM((*this), vp, i) = Zero; List_END_FOR_ALL }
void Foam::UList<T>::deepCopy(const UList<T>& a) { if (a.size_ != this->size_) { FatalErrorInFunction << "ULists have different sizes: " << this->size_ << " " << a.size_ << abort(FatalError); } if (this->size_) { #ifdef USEMEMCPY if (contiguous<T>()) { memcpy(this->v_, a.v_, this->byteSize()); } else #endif { List_ACCESS(T, (*this), vp); List_CONST_ACCESS(T, a, ap); List_FOR_ALL((*this), i) List_ELEM((*this), vp, i) = List_ELEM(a, ap, i); List_END_FOR_ALL } } }
void Foam::UList<T>::swap(UList<T>& a) { if (a.size_ != this->size_) { FatalErrorIn("UList<T>::swap(const UList<T>&)") << "ULists have different sizes: " << this->size_ << " " << a.size_ << abort(FatalError); } List_ACCESS(T, (*this), vp); List_ACCESS(T, a, ap); T tmp; List_FOR_ALL((*this), i) tmp = List_ELEM((*this), vp, i); List_ELEM((*this), vp, i) = List_ELEM(a, ap, i); List_ELEM(a, ap, i) = tmp; List_END_FOR_ALL }
Foam::List<T>::List(const label s, const T& a) : UList<T>(NULL, s) { if (this->size_ < 0) { FatalErrorIn("List<T>::List(const label size, const T&)") << "bad size " << this->size_ << abort(FatalError); } if (this->size_) { this->v_ = new T[this->size_]; List_ACCESS(T, (*this), vp); List_FOR_ALL((*this), i) List_ELEM((*this), vp, i) = a; List_END_FOR_ALL }