Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
6d5ad339
Commit
6d5ad339
authored
Oct 29, 2017
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made hamming_distance() a little more general.
parent
bc377891
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
0 deletions
+20
-0
count_bits.h
dlib/general_hash/count_bits.h
+20
-0
No files found.
dlib/general_hash/count_bits.h
View file @
6d5ad339
...
...
@@ -54,6 +54,26 @@ namespace dlib
return
count_bits
(
a
^
b
);
}
// ----------------------------------------------------------------------------------------
template
<
typename
T
>
T
hamming_distance
(
const
std
::
pair
<
T
,
T
>&
a
,
const
std
::
pair
<
T
,
T
>&
b
)
/*!
requires
- T is an unsigned integral type or a std::pair that, recursively, eventually
contains unsigned integral types.
ensures
- returns the number of bits which differ between a and b.
!*/
{
return
hamming_distance
(
a
.
first
,
b
.
first
)
+
hamming_distance
(
a
.
second
,
b
.
second
);
}
// ----------------------------------------------------------------------------------------
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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