gdb::optional: Add observers
authorPedro Alves <palves@redhat.com>
Tue, 4 Apr 2017 19:03:25 +0000 (20:03 +0100)
committerPedro Alves <palves@redhat.com>
Tue, 4 Apr 2017 19:03:25 +0000 (20:03 +0100)
commitd194f1fe51cb85b8a919b7ee9e3a7715b0ec9744
tree00c457bd60e59b73e5ea8b42d9de64b8505cbdf1
parentfff8551cf549f4047c9276a836408d802db6ce6d
gdb::optional: Add observers

Currently, gdb::optional is really minimal and can only be used for
lazy initialization.  There's no way to get at the value contained
inside the optinal.  This commit corrects that, by adding observer
methods, mostly copied from libstdc++'s implementation of C++17
std::optional.

This will be used in the following patch.

gdb/ChangeLog:
2017-04-04  Pedro Alves  <palves@redhat.com>

* common/gdb_optional.h (gdb::optiona): Add operator->, operator*,
operator bool, has_value and get methods.
gdb/ChangeLog
gdb/common/gdb_optional.h