34 ptrs_.setAddressableSize(
n);
41 return ptrs_.find_next(
pos);
64 ptrs_(
std::move(ptrs))
78 ptrs_(
std::move(list.ptrs_))
85 ptrs_(list.ptrs_, reuse)
101 const label len = ptrs_.size();
103 for (label i = 0; i < len; ++i)
105 ptrs_[i] = &(list[i]);
115 return ptrs_.empty();
129 return ptrs_.count();
157 const T* ptr = ptrs_.get(i);
162 <<
"Cannot dereference nullptr at index " << i
163 <<
" in range [0," << size() <<
")\n" 174 T* ptr = ptrs_.get(i);
179 <<
"Cannot dereference nullptr at index " << i
180 <<
" in range [0," << size() <<
")\n" 218 ptrs_.swap(list.
ptrs_);
225 ptrs_.transfer(list.
ptrs_);
246 return this->at(this->size()-1);
253 return this->at(this->size()-1);
260 ptrs_.resize(newLen);
267 ptrs_.push_back(ptr);
274 ptrs_.push_back(other.ptrs_);
282 ptrs_.checkNonNull();
326 pos_ = list_->find_next(-1);
347 return this->
good() ? this->
list_->get(this->
pos_) :
nullptr;
354 return this->list_->at(this->pos_);
382 return this->good() ? this->list_->get(this->pos_) :
nullptr;
389 return this->list_->at(this->pos_);
474 ptrs_.transfer(list.ptrs_);
reference val() const
Reference to the object.
list_type * list_
The parent being iterated.
const T & operator[](const label i) const
Return const reference to the element at given position. FatalError for bounds problem or nullptr...
const T * test(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie...
constexpr UPtrList() noexcept
Default construct.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
T & back()
Reference to the last element of the list.
iterator & operator++()
Move to the next non-nullptr entry.
A rudimentary list of pointers used for PtrList, UPtrList, etc. This class is considered implementati...
const_iterator & operator++()
Move to the next non-nullptr entry.
const T * get(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie...
const T & at(const label i) const
Return const reference to the element at given position. FatalError for bounds problem or nullptr...
T & front()
Reference to the first element of the list.
Forward iterator with const access.
label pos_
The position within the list.
Forward iterator with non-const access.
dimensionedScalar pos(const dimensionedScalar &ds)
void free()
Nullify all entries. Does not change the list size.
void push_back(T *ptr)
Append an element to the end of the list.
label size() const noexcept
The number of entries in the list.
void checkNonNull() const
Check and raise FatalError if any nullptr exists in the list.
void transfer(UPtrList< T > &list)
Transfer contents into this list and annul the argument.
reference val() const
Reference to the object.
friend class Iterator< true >
Allow iterator access to internals.
void resize(const label newLen)
Change the size of the list.
void swap(UPtrList< T > &list)
Swap content.
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
errorManip< error > abort(error &err)
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
pointer get() const
Pointer to the referenced object (failsafe)
void operator=(const UPtrList< T > &list)
Copy assignment (shallow copies addresses)
label find_next(label pos) const
The next non-null entry after the specified position.
bool empty() const noexcept
True if the list is empty (ie, size() is zero)
iterator begin()
Return iterator to begin traversal of non-nullptr entries.
iterator end() noexcept
Return iterator beyond end of UPtrList traversal.
pointer get() const
Pointer to the referenced object (failsafe)
const_iterator cend() const noexcept
Return const_iterator beyond end of UPtrList traversal.
bool good() const noexcept
True if iterator points to a non-null entry.
void clear()
Set list size to zero.
const_iterator cbegin() const
Return const_iterator to begin traversal of non-nullptr entries.
Detail::PtrListDetail< T > ptrs_
The list of pointers.
void setAddressableSize(const label n) noexcept
Adjust addressable size.
label count() const noexcept
The number of non-null entries in the list.
friend class Iterator< false >
Allow iterator access to internals.
const T * set(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie...