Skip to content
Snippets Groups Projects
Commit 4dff2bfa authored by Mark OLESEN's avatar Mark OLESEN
Browse files

STYLE: PtrList emplace_set for symmetry with HashPtrTable method naming

parent d5c0852d
Branches
Tags
No related merge requests found
......@@ -173,6 +173,10 @@ public:
//- (discard old element at that location).
//- Return reference to the new list element.
template<class... Args>
inline T& emplace_set(const label i, Args&&... args);
//- Same as emplace_set()
template<class... Args>
inline T& emplace(const label i, Args&&... args);
//- Set element to given pointer and return old element (can be null)
......
......@@ -172,11 +172,17 @@ inline void Foam::PtrList<T>::push_back(PtrList<T>&& other)
template<class T>
template<class... Args>
inline T& Foam::PtrList<T>::emplace
(
const label i,
Args&&... args
)
inline T& Foam::PtrList<T>::emplace_set(const label i, Args&&... args)
{
T* ptr = new T(std::forward<Args>(args)...);
(void)this->set(i, ptr);
return *ptr;
}
template<class T>
template<class... Args>
inline T& Foam::PtrList<T>::emplace(const label i, Args&&... args)
{
T* ptr = new T(std::forward<Args>(args)...);
(void)this->set(i, ptr);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment