50#ifndef Foam_UPtrList_H
51#define Foam_UPtrList_H
62template<
class T>
class PtrList;
119 template<
class Compare>
148 bool operator()(
const label ai,
const label bi)
const
150 const T*
const a =
values.get(ai);
153 return (a &&
b) ? (*a < *
b) :
bool(a);
169 bool operator()(
const label ai,
const label bi)
const
171 const T*
const a =
values.get(ai);
174 return (a &&
b) ? (*
b < *a) :
bool(
b);
185 inline explicit
UPtrList(const label len);
224 inline const
T&
first() const;
230 inline const
T&
last() const;
235 inline const
T*
test(const label i) const;
240 inline
T*
get(const label i);
244 inline const
T*
get(const label i) const;
249 const
T*
set(const label i)
const {
return this->
get(i); }
259 inline void resize(
const label newLen);
283 inline T*
set(
const label i,
T* ptr);
384 const T*
const* ptr_;
487template<class
T, class Compare>
497#include "UPtrListI.H"
A rudimentary list of pointers used for PtrList, UPtrList, etc. This class is considered implementati...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Random-access iterator with const access.
reference operator()() const
std::random_access_iterator_tag iterator_category
Random-access iterator with non-const access.
reference operator*() const
reference operator()() const
pointer operator->() const
std::random_access_iterator_tag iterator_category
friend class const_iterator
reference operator[](difference_type n) const
pointer get() const
Return pointer, can be nullptr.
iterator & operator++() noexcept
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
const T & operator[](const label i) const
Return const reference to the element.
const T * set(const label i) const
void swap(UPtrList< T > &list)
Swap content.
void append(T *ptr)
Append an element to the end of the list.
void setSize(const label n)
Alias for resize()
T & first()
Return reference to the first element of the list.
T ** begin_ptr() noexcept
Iterator to begin of raw pointers traversal (use with caution)
T value_type
Type of values the list contains.
void reorder(const labelUList &oldToNew, const bool check=false)
bool empty() const noexcept
True if the list is empty (ie, size() is zero)
void operator=(const UPtrList< T > &list)
Copy assignment (shallow copies addresses)
const_iterator cbegin() const noexcept
Return const_iterator to begin of UPtrList traversal.
constexpr UPtrList() noexcept
Default construct.
const T * test(const label i) const
void sortOrder(const labelUList &order, const bool check=false)
T ** end_ptr() noexcept
Iterator beyond end of raw pointers traversal (use with caution)
const_iterator cend() const noexcept
Return const_iterator beyond end of UPtrList traversal.
label size() const noexcept
The number of elements in the list.
T & reference
A non-const reference to the value_type.
label squeezeNull()
Squeeze out intermediate nullptr entries in the list of pointers.
void transfer(UPtrList< T > &list)
Transfer contents into this list and annul the argument.
Detail::PtrListDetail< T > ptrs_
The list of pointers.
void clear()
Set list size to zero.
void checkNonNull() const
Check and raise FatalError if any nullptr exists in the list.
iterator begin() noexcept
Return an iterator to begin of UPtrList traversal.
iterator end() noexcept
Return iterator beyond end of UPtrList traversal.
void setAddressableSize(const label n) noexcept
Adjust addressable size.
const T * operator()(const label i) const
Return const pointer to the element - same as get().
T & last()
Return reference to the last element of the list.
friend Ostream & operator(Ostream &os, const UPtrList< T > &list)
Write UPtrList to Ostream.
void resize(const label newLen)
Change the size of the list.
const T & const_reference
A const reference to the value_type.
OBJstream os(runTime.globalPath()/outputName)
static void check(const int retVal, const char *what)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
void sort(UList< T > &list)
Sort the list.
A UPtrList compare binary predicate for reverse sort order.
bool operator()(const label ai, const label bi) const
Compare dereferenced pointer locations for reverse sort.
greater(const UPtrList< T > &list)
const UPtrList< T > & values
less(const UPtrList< T > &list)
bool operator()(const label ai, const label bi) const
Compare dereferenced pointer locations for normal sort.
const UPtrList< T > & values
value_compare(const Compare &cmp)
bool operator()(const T *const a, const T *const b) const
Compare dereferenced pointers.