Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
openfoam
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Development
openfoam
Commits
5388a95d
Commit
5388a95d
authored
13 years ago
by
mattijs
Browse files
Options
Downloads
Patches
Plain Diff
ENH: Hash: template specialisation for Hash<string> and derivatives
parent
3a3bd932
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/OpenFOAM/primitives/hashes/Hash/Hash.H
+104
-1
104 additions, 1 deletion
src/OpenFOAM/primitives/hashes/Hash/Hash.H
with
104 additions
and
1 deletion
src/OpenFOAM/primitives/hashes/Hash/Hash.H
+
104
−
1
View file @
5388a95d
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011
-2012
OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
...
...
@@ -37,6 +37,8 @@ Description
#include
"uLabel.H"
#include
"Hasher.H"
#include
"pTraits.H"
#include
"fileName.H"
#include
"wordRe.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
@@ -99,6 +101,107 @@ public:
};
//- Hash specialization for hashing strings
template
<
>
class
Hash
<
Foam
::
string
>
{
public:
Hash
()
{}
unsigned
operator
()(
const
string
&
p
,
unsigned
seed
)
const
{
return
string
::
hash
()(
p
,
seed
);
}
unsigned
operator
()(
const
string
&
p
)
const
{
return
string
::
hash
()(
p
);
}
};
//- Hash specialization for hashing words
template
<
>
class
Hash
<
Foam
::
word
>
{
public:
Hash
()
{}
unsigned
operator
()(
const
word
&
p
,
unsigned
seed
)
const
{
return
word
::
hash
()(
p
,
seed
);
}
unsigned
operator
()(
const
word
&
p
)
const
{
return
word
::
hash
()(
p
);
}
};
//- Hash specialization for hashing fileNames
template
<
>
class
Hash
<
Foam
::
fileName
>
{
public:
Hash
()
{}
unsigned
operator
()(
const
fileName
&
p
,
unsigned
seed
)
const
{
return
fileName
::
hash
()(
p
,
seed
);
}
unsigned
operator
()(
const
fileName
&
p
)
const
{
return
fileName
::
hash
()(
p
);
}
};
//- Hash specialization for hashing wordRes
template
<
>
class
Hash
<
Foam
::
wordRe
>
{
public:
Hash
()
{}
unsigned
operator
()(
const
wordRe
&
p
,
unsigned
seed
)
const
{
return
wordRe
::
hash
()(
p
,
seed
);
}
unsigned
operator
()(
const
wordRe
&
p
)
const
{
return
wordRe
::
hash
()(
p
);
}
};
//- Hash specialization for hashing keyTypes
template
<
>
class
Hash
<
Foam
::
keyType
>
{
public:
Hash
()
{}
unsigned
operator
()(
const
keyType
&
p
,
unsigned
seed
)
const
{
return
keyType
::
hash
()(
p
,
seed
);
}
unsigned
operator
()(
const
keyType
&
p
)
const
{
return
keyType
::
hash
()(
p
);
}
};
//- Hash specialization for hashing pointer addresses.
// Treat a pointer like a long.
// This should work for both 32-bit and 64-bit pointers.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment