projects
/
platform
/
upstream
/
libHarfBuzzSharp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
750d5af
)
[map] Make .has() optionally return value
author
Behdad Esfahbod
<behdad@behdad.org>
Wed, 8 May 2019 19:11:52 +0000
(12:11 -0700)
committer
Behdad Esfahbod
<behdad@behdad.org>
Wed, 8 May 2019 19:11:52 +0000
(12:11 -0700)
src/hb-map.hh
patch
|
blob
|
history
diff --git
a/src/hb-map.hh
b/src/hb-map.hh
index
f27ca9c
..
13099af
100644
(file)
--- a/
src/hb-map.hh
+++ b/
src/hb-map.hh
@@
-181,7
+181,12
@@
struct hb_hashmap_t
static constexpr V SENTINEL = vINVALID;
typedef V value_t;
value_t operator [] (K k) const { return get (k); }
- bool has (K k) const { return (*this)[k] != SENTINEL; }
+ bool has (K k, V *vp = nullptr) const
+ {
+ V v = (*this)[k];
+ if (vp) *vp = v;
+ return v != SENTINEL;
+ }
/* Projection. */
V operator () (K k) const { return get (k); }