mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: update List and DynamicList methods (issue #595)
- improve functional compatibility with DynList (remove methods) * eg, remove an element from any position in a DynamicList * reduce the number of template parameters * remove/subset regions of DynamicList - propagate Swap template specializations for lists, hashtables - move construct/assignment to various containers. - add find/found methods for FixedList and UList for a more succinct (and clearer?) usage than the equivalent global findIndex() function. - simplify List_FOR_ALL loops
This commit is contained in:
@ -93,6 +93,18 @@ Foam::HashTable<T, Key, Hash>::HashTable(const HashTable<T, Key, Hash>& ht)
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
Foam::HashTable<T, Key, Hash>::HashTable(HashTable<T, Key, Hash>&& ht)
|
||||
:
|
||||
HashTableCore(),
|
||||
nElmts_(0),
|
||||
tableSize_(0),
|
||||
table_(nullptr)
|
||||
{
|
||||
transfer(ht);
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
Foam::HashTable<T, Key, Hash>::HashTable
|
||||
(
|
||||
@ -750,6 +762,15 @@ void Foam::HashTable<T, Key, Hash>::clearStorage()
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
void Foam::HashTable<T, Key, Hash>::swap(HashTable<T, Key, Hash>& ht)
|
||||
{
|
||||
Foam::Swap(table_, ht.table_);
|
||||
Foam::Swap(tableSize_, ht.tableSize_);
|
||||
Foam::Swap(nElmts_, ht.nElmts_);
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
void Foam::HashTable<T, Key, Hash>::transfer(HashTable<T, Key, Hash>& ht)
|
||||
{
|
||||
@ -908,6 +929,24 @@ void Foam::HashTable<T, Key, Hash>::operator=
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
void Foam::HashTable<T, Key, Hash>::operator=
|
||||
(
|
||||
HashTable<T, Key, Hash>&& rhs
|
||||
)
|
||||
{
|
||||
// Check for assignment to self
|
||||
if (this == &rhs)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "attempted assignment to self"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
transfer(rhs);
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
bool Foam::HashTable<T, Key, Hash>::operator==
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user