aboutsummaryrefslogtreecommitdiff
path: root/re2/re2.h
diff options
context:
space:
mode:
authorPaul Wankadia <junyer@google.com>2016-09-09 16:00:28 +1000
committerPaul Wankadia <junyer@google.com>2016-09-09 06:04:19 +0000
commitda1249d9b5f34f3f8170d07ee5869b510eb477d0 (patch)
treeb4ccc96dc261c89ec56ec0328efb1e39521cc407 /re2/re2.h
parentd9e6245a6506876d2e9129eade0ed70f69ac456f (diff)
downloadregex-re2-da1249d9b5f34f3f8170d07ee5869b510eb477d0.tar.gz
Avoid heap allocations on the fast path for onces.
Capturing anything (including `this') is convenient, but expensive due to the overhead of std::function<> objects. Change-Id: Ibe8e91a1a09090d5abde1bb6d78d2617243045b9 Reviewed-on: https://code-review.googlesource.com/7532 Reviewed-by: Paul Wankadia <junyer@google.com>
Diffstat (limited to 're2/re2.h')
-rw-r--r--re2/re2.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/re2/re2.h b/re2/re2.h
index 377a04d..c49de05 100644
--- a/re2/re2.h
+++ b/re2/re2.h
@@ -905,7 +905,7 @@ class LazyRE2 {
// Named accessor/initializer:
RE2* get() const {
- std::call_once(once_, [this]() { LazyRE2::Init(this); });
+ std::call_once(once_, &LazyRE2::Init, this);
return ptr_;
}