diff options
author | Paul Wankadia <junyer@google.com> | 2016-09-09 16:00:28 +1000 |
---|---|---|
committer | Paul Wankadia <junyer@google.com> | 2016-09-09 06:04:19 +0000 |
commit | da1249d9b5f34f3f8170d07ee5869b510eb477d0 (patch) | |
tree | b4ccc96dc261c89ec56ec0328efb1e39521cc407 /re2/re2.h | |
parent | d9e6245a6506876d2e9129eade0ed70f69ac456f (diff) | |
download | regex-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.h | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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_; } |