aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/HashTest.cpp
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2015-10-15 12:23:01 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-10-15 12:23:02 -0700
commitc8d1dd48c01f562cfffe64da0e5cee5ed2713541 (patch)
treed561462e44e5b2f644b41c1fd670c1e66c5f03de /tests/HashTest.cpp
parentb9519f86bbce946e505980a4fa950fdc4bcf74ab (diff)
SkTHash: hash from fnptr to functor type
Passing &SkGoodHash to SkTHashMap and SkTHashSet doesn't guarantee that it's actually instantiated. Using a functor does. BUG=skia: Review URL: https://codereview.chromium.org/1405053002
Diffstat (limited to 'tests/HashTest.cpp')
-rw-r--r--tests/HashTest.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/HashTest.cpp b/tests/HashTest.cpp
index c90c377cc2..c9b1bc967b 100644
--- a/tests/HashTest.cpp
+++ b/tests/HashTest.cpp
@@ -120,14 +120,16 @@ private:
uint32_t* fCounter;
};
-uint32_t hash_copy_counter(const CopyCounter&) {
- return 0; // let them collide, what do we care?
-}
+struct HashCopyCounter {
+ uint32_t operator()(const CopyCounter&) const {
+ return 0; // let them collide, what do we care?
+ }
+};
}
DEF_TEST(HashSetCopyCounter, r) {
- SkTHashSet<CopyCounter, hash_copy_counter> set;
+ SkTHashSet<CopyCounter, HashCopyCounter> set;
uint32_t globalCounter = 0;
CopyCounter copyCounter1(1, &globalCounter);