Commit fa8d9727 authored by Mark Olesen's avatar Mark Olesen
Browse files

STYLE: replace HashSet/HashTable xfer with equivalent movable (issue #726)

- avoid confusion by using HashTable::lookup(key, deflt) explicitly
  instead of allowing an operator() version.
parent e42c2281
......@@ -122,10 +122,7 @@ Foam::HashSet<Key, Hash>::HashSet
:
parent_type(tbl.capacity())
{
using other_iter =
typename HashTable<AnyType, Key, AnyHash>::const_iterator;
for (other_iter iter = tbl.cbegin(); iter != tbl.cend(); ++iter)
for (auto iter = tbl.cbegin(); iter != tbl.cend(); ++iter)
{
this->insert(iter.key());
}
......
......@@ -162,18 +162,6 @@ public:
parent_type(std::move(hs))
{}
//- Construct by transferring the parameter contents
HashSet(const Xfer<this_type>& hs)
:
parent_type(hs)
{}
//- Construct by transferring the parameter contents
HashSet(const Xfer<parent_type>& hs)
:
parent_type(hs)
{}
//- Construct from the keys of another HashTable,
//- the type of values held is arbitrary.
template<class AnyType, class AnyHash>
......
......@@ -108,18 +108,6 @@ Foam::HashTable<T, Key, Hash>::HashTable(HashTable<T, Key, Hash>&& ht)
}
template<class T, class Key, class Hash>
Foam::HashTable<T, Key, Hash>::HashTable
(
const Xfer<HashTable<T, Key, Hash>>& ht
)
:
HashTable<T, Key, Hash>(0)
{
transfer(ht());
}
template<class T, class Key, class Hash>
Foam::HashTable<T, Key, Hash>::HashTable
(
......
......@@ -83,7 +83,6 @@ SourceFiles
#include "word.H"
#include "zero.H"
#include "Xfer.H"
#include "Hash.H"
#include "HashTableCore.H"
......@@ -343,9 +342,6 @@ public:
//- Move construct
HashTable(this_type&& ht);
//- Construct by transferring the parameter contents
HashTable(const Xfer<this_type>& ht);
//- Construct from an initializer list
HashTable(std::initializer_list<std::pair<Key, T>> lst);
......@@ -602,9 +598,6 @@ public:
// and annul the argument table.
void transfer(HashTable<T, Key, Hash>& ht);
//- Transfer contents to the Xfer container
inline Xfer<HashTable<T, Key, Hash>> xfer();
// Member Operators
......@@ -622,9 +615,6 @@ public:
//- Return existing entry or insert a new entry.
inline T& operator()(const Key& key, const T& deflt);
//- Return hashed entry if it exists, or return the given default
inline const T& operator()(const Key& key, const T& deflt) const;
//- Assignment
void operator=(const HashTable<T, Key, Hash>& rhs);
......
......@@ -136,14 +136,6 @@ inline bool Foam::HashTable<T, Key, Hash>::set
}
template<class T, class Key, class Hash>
inline Foam::Xfer<Foam::HashTable<T, Key, Hash>>
Foam::HashTable<T, Key, Hash>::xfer()
{
return xferMove(*this);
}
template<class T, class Key, class Hash>
inline const T& Foam::HashTable<T, Key, Hash>::lookup
(
......@@ -226,17 +218,6 @@ inline T& Foam::HashTable<T, Key, Hash>::operator()
}
template<class T, class Key, class Hash>
inline const T& Foam::HashTable<T, Key, Hash>::operator()
(
const Key& key,
const T& deflt
) const
{
return this->lookup(key, deflt);
}
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
template<class T, class Key, class Hash>
......
......@@ -100,18 +100,6 @@ public:
parent_type(std::move(map))
{}
//- Construct by transferring the parameter contents
Map(const Xfer<this_type>& map)
:
parent_type(map)
{}
//- Construct by transferring the parameter contents
Map(const Xfer<parent_type>& map)
:
parent_type(map)
{}
//- Construct from an initializer list
Map(std::initializer_list<std::pair<label, T>> map)
:
......
......@@ -730,7 +730,7 @@ void Foam::globalPoints::remove
// those points where the equivalence list is only me and my (face)neighbour
// Save old ones.
Map<label> oldMeshToProcPoint(meshToProcPoint_.xfer());
Map<label> oldMeshToProcPoint(std::move(meshToProcPoint_));
meshToProcPoint_.resize(oldMeshToProcPoint.size());
DynamicList<labelPairList> oldProcPoints(procPoints_.xfer());
procPoints_.setCapacity(oldProcPoints.size());
......
Markdown is supported
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