diff options
author | jdoerrie <jdoerrie@chromium.org> | 2018-06-09 04:52:09 +0900 |
---|---|---|
committer | Qijiang Fan <fqj@google.com> | 2020-06-05 09:38:02 +0900 |
commit | edddfa6b735c0cb4e86127544347a02beb827fd5 (patch) | |
tree | dd76a5c93abcaa2055ec3c7244bb7ee061d8ca74 /base/optional.h | |
parent | 1b8b07678b704df997cdd52797598b4b4517ae8b (diff) | |
download | libchrome-edddfa6b735c0cb4e86127544347a02beb827fd5.tar.gz |
[base] Remove CHECKs in base::Optional operator* and ->
This change partially reverts r550197 which introduced CHECKs to
base::Optional's operator*, operator-> and value(). This is done to
reduce binary size and to be more standard's compliant, as std::optional
also doesn't perform checks for operator* and operator->. Lastly, the
CHECKs in value() are kept, as here CHECKing is desired, and also
matches std::optional's behaviour.
Bug: 832678
Change-Id: I467c7d7623c2880ee761b8a58a74738c09e0ba2a
Reviewed-on: https://chromium-review.googlesource.com/1093314
Reviewed-by: Nico Weber <thakis@chromium.org>
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Cr-Commit-Position: refs/heads/master@{#565720}
CrOS-Libchrome-Original-Commit: a000101f58501dac2d090ba09f61cb292f7c9f6b
Diffstat (limited to 'base/optional.h')
-rw-r--r-- | base/optional.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/base/optional.h b/base/optional.h index c1d11ca7a1..8b570ccd69 100644 --- a/base/optional.h +++ b/base/optional.h @@ -575,32 +575,32 @@ class OPTIONAL_DECLSPEC_EMPTY_BASES Optional } constexpr const T* operator->() const { - CHECK(storage_.is_populated_); + DCHECK(storage_.is_populated_); return &storage_.value_; } constexpr T* operator->() { - CHECK(storage_.is_populated_); + DCHECK(storage_.is_populated_); return &storage_.value_; } constexpr const T& operator*() const & { - CHECK(storage_.is_populated_); + DCHECK(storage_.is_populated_); return storage_.value_; } constexpr T& operator*() & { - CHECK(storage_.is_populated_); + DCHECK(storage_.is_populated_); return storage_.value_; } constexpr const T&& operator*() const && { - CHECK(storage_.is_populated_); + DCHECK(storage_.is_populated_); return std::move(storage_.value_); } constexpr T&& operator*() && { - CHECK(storage_.is_populated_); + DCHECK(storage_.is_populated_); return std::move(storage_.value_); } |