mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
HashTable: Added C++11 initializer_list constructor
e.g.
HashTable<label, string> table1
{
{"kjhk", 10},
{"kjhk2", 12}
};
HashTable<label, label, Hash<label>> table2
{
{3, 10},
{5, 12},
{7, 16}
};
This commit is contained in:
@ -49,6 +49,7 @@ SourceFiles
|
||||
#include "word.H"
|
||||
#include "Xfer.H"
|
||||
#include "className.H"
|
||||
#include <initializer_list>
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -62,6 +63,9 @@ template<class T> class UList;
|
||||
template<class T, class Key, class Hash> class HashTable;
|
||||
template<class T, class Key, class Hash> class HashPtrTable;
|
||||
|
||||
template<class Type1, class Type2>
|
||||
class Tuple2;
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
Istream& operator>>(Istream&, HashTable<T, Key, Hash>&);
|
||||
|
||||
@ -171,6 +175,7 @@ class HashTable
|
||||
//- Assign a new hashedEntry to a possibly already existing key
|
||||
bool set(const Key&, const T& newElmt, bool protect);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Forward declaration of iterators
|
||||
@ -207,6 +212,9 @@ public:
|
||||
//- Construct by transferring the parameter contents
|
||||
HashTable(const Xfer<HashTable<T, Key, Hash>>&);
|
||||
|
||||
//- Construct from an initializer list
|
||||
HashTable(std::initializer_list<Tuple2<Key, T>> lst);
|
||||
|
||||
|
||||
//- Destructor
|
||||
~HashTable();
|
||||
|
||||
Reference in New Issue
Block a user