cleanup autoPtr, tmp, xfer
- Some constructors and methods can be constexpr, noexcept.
- most places have a const copy constructor that steals the contents. Could/should be revised to use a universal reference and prohibit const copy (as per std::unique_ptr).
No child items are currently assigned. Use child items to break down this issue into smaller parts.
Link issues together to show that they're related. Learn more.
Activity
- Author Maintainer
-
consider if we can relocate refCount into tmp itself by using a shared_ptr.
-
see where std::forward() might do better service than the
clone()
methods. Maybe able to make as an autoPtr factory method.
-
- Author Maintainer
In
UList.H
template<class T> inline void Swap(UList<T>& a, UList<T>& b);
this can quite easily cause problems for inheriting classes with additional members, which would not be swapped. It is probably better to use the standard Foam::Swap template:
T tmp(std::move(a)); a = std::move(b); b = std::move(tmp);
... just need to ensure that the derived classes implement move construct and move assignment. Could/should also add the same semantics to UList (fairly similar to an explicit shallowCopy).
- Author Maintainer
Using isTmp() is non always safe to assume that the content is really movable.
The internal refCount count easily be greater than 0, but we steal the content and leave behind other shared instances with no content.
Propose:
bool movable() const { return isTmp() && ptr_ && ptr_->unique(); }
- Maintainer
More: GeometricField from tmp. Does not transfer boundaryField.
- Mark OLESEN mentioned in commit f984c56c6b450d82594008ea32996f189afa8b10
mentioned in commit f984c56c6b450d82594008ea32996f189afa8b10
- Mark OLESEN mentioned in commit 0eb18546e761899aaafd24df2aa5d9ace5ff30ca
mentioned in commit 0eb18546e761899aaafd24df2aa5d9ace5ff30ca
- Mark OLESEN mentioned in commit a59f7b9da58719dd9c4ab570dd6f756faed31f13
mentioned in commit a59f7b9da58719dd9c4ab570dd6f756faed31f13
- Mark OLESEN mentioned in commit d526ef73baba43d6bd40476ee3ad79fa0b875113
mentioned in commit d526ef73baba43d6bd40476ee3ad79fa0b875113
- Mark OLESEN mentioned in merge request !192 (merged)
mentioned in merge request !192 (merged)
- Mark OLESEN mentioned in commit ad33d01a0918f11e1bf70fa908e83b3ccd9837a4
mentioned in commit ad33d01a0918f11e1bf70fa908e83b3ccd9837a4
- Mark OLESEN mentioned in commit 96d454860e682cbc1d75b25ecb3140d1d23a1bf8
mentioned in commit 96d454860e682cbc1d75b25ecb3140d1d23a1bf8
- Mark OLESEN mentioned in commit a2d439010d825b13c23adb869ca58211275c173c
mentioned in commit a2d439010d825b13c23adb869ca58211275c173c
- Mark OLESEN made the issue visible to everyone
made the issue visible to everyone
- Mark OLESEN closed
closed
- Mark OLESEN mentioned in commit de544c94
mentioned in commit de544c94