diff options
author | Abseil Team <absl-team@google.com> | 2019-05-22 05:06:50 -0700 |
---|---|---|
committer | Derek Mauro <dmauro@google.com> | 2019-05-22 09:07:07 -0400 |
commit | ce65f5ac3cbf897bb5e3de1a51d80fd00866abaa (patch) | |
tree | 60b88792ce60bf1dd8569b684eb3c3ed9b866e2d /absl/types | |
parent | a18fc7461e7409c2ad64e28537261db1e02e76fa (diff) | |
download | abseil-ce65f5ac3cbf897bb5e3de1a51d80fd00866abaa.tar.gz abseil-ce65f5ac3cbf897bb5e3de1a51d80fd00866abaa.tar.bz2 abseil-ce65f5ac3cbf897bb5e3de1a51d80fd00866abaa.zip |
Export of internal Abseil changes.
--
1edfe05ddddca43e7650b2d790df7c8498c0e588 by Abseil Team <absl-team@google.com>:
Adding an assert to catch various misuses of std::optional.
PiperOrigin-RevId: 249427865
--
45463bbb7e59dfbc584b2f024368a63db98bd7a8 by CJ Johnson <johnsoncj@google.com>:
Migrates internal member function GetAllocator() to GetAllocPtr() and changes the return type to pointer instead of reference to avoid unnecessary copy in DestroyElements(...)
PiperOrigin-RevId: 249319571
--
507835be22af85676143ee0c43a80a52bc32094c by Abseil Team <absl-team@google.com>:
Fix -Wstring-conversion in GetEnvVar (Windows implementation).
PiperOrigin-RevId: 249201897
GitOrigin-RevId: 1edfe05ddddca43e7650b2d790df7c8498c0e588
Change-Id: I9300131887ee507cf80d399c724cf87341e4f11a
Diffstat (limited to 'absl/types')
-rw-r--r-- | absl/types/optional.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/absl/types/optional.h b/absl/types/optional.h index 1670022d..142dc83a 100644 --- a/absl/types/optional.h +++ b/absl/types/optional.h @@ -421,7 +421,9 @@ class optional : private optional_internal::optional_data<T>, // // Accesses the underlying `T` value of an `optional`. If the `optional` is // empty, behavior is undefined. - constexpr const T& operator*() const & { return reference(); } + constexpr const T& operator*() const& { + return ABSL_ASSERT(this->engaged_), reference(); + } T& operator*() & { assert(this->engaged_); return reference(); |