Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
OpenFOAM-plus
Commits
275a59af
Commit
275a59af
authored
Aug 11, 2016
by
Henry Weller
Browse files
HashTable: Added void operator=(std::initializer_list<Tuple2<Key, T>>)
parent
e3802230
Changes
3
Hide whitespace changes
Inline
Side-by-side
applications/test/HashTable/Test-hashTable.C
View file @
275a59af
...
...
@@ -165,6 +165,16 @@ int main()
table3
.
clearStorage
();
Info
<<
table3
<<
nl
;
table1
=
{
{
"aca"
,
3
.
0
},
{
"aaw"
,
6
.
0
},
{
"acr"
,
8
.
0
},
{
"aec"
,
10
.
0
}
};
Info
<<
"
\n
table1"
<<
table1
<<
nl
;
Info
<<
"
\n
Done
\n
"
;
return
0
;
...
...
src/OpenFOAM/containers/HashTables/HashTable/HashTable.C
View file @
275a59af
...
...
@@ -563,6 +563,29 @@ void Foam::HashTable<T, Key, Hash>::operator=
}
template
<
class
T
,
class
Key
,
class
Hash
>
void
Foam
::
HashTable
<
T
,
Key
,
Hash
>::
operator
=
(
std
::
initializer_list
<
Tuple2
<
Key
,
T
>>
lst
)
{
// Could be zero-sized from a previous transfer()
if
(
!
tableSize_
)
{
resize
(
lst
.
size
());
}
else
{
clear
();
}
for
(
const
Tuple2
<
Key
,
T
>&
pair
:
lst
)
{
insert
(
pair
.
first
(),
pair
.
second
());
}
}
template
<
class
T
,
class
Key
,
class
Hash
>
bool
Foam
::
HashTable
<
T
,
Key
,
Hash
>::
operator
==
(
...
...
src/OpenFOAM/containers/HashTables/HashTable/HashTable.H
View file @
275a59af
...
...
@@ -213,7 +213,7 @@ public:
HashTable
(
const
Xfer
<
HashTable
<
T
,
Key
,
Hash
>>&
);
//- Construct from an initializer list
HashTable
(
std
::
initializer_list
<
Tuple2
<
Key
,
T
>>
lst
);
HashTable
(
std
::
initializer_list
<
Tuple2
<
Key
,
T
>>
);
//- Destructor
...
...
@@ -315,6 +315,9 @@ public:
//- Assignment
void
operator
=
(
const
HashTable
<
T
,
Key
,
Hash
>&
);
//- Assignment to an initializer list
void
operator
=
(
std
::
initializer_list
<
Tuple2
<
Key
,
T
>>
);
//- Equality. Hash tables are equal if the keys and values are equal.
// Independent of table storage size and table order.
bool
operator
==
(
const
HashTable
<
T
,
Key
,
Hash
>&
)
const
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment