mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: PtrList emplace_set for symmetry with HashPtrTable method naming
This commit is contained in:
@ -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);
|
||||
|
||||
Reference in New Issue
Block a user