diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2020-02-13 17:15:05 +0100 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2020-02-13 17:15:05 +0100 |
commit | 9af10b753c8a636f828b148fc3a9aecd1c0067fa (patch) | |
tree | 1ebfeb34a00591cabb2d2c57d12eea36fae9d9d0 /src/libexpr/attr-set.hh | |
parent | d8972317fc4314864619cadd5620ae780da657a3 (diff) |
Bindings::get(): std::optional<Attr *> -> Attr *
Returning a nullable type in an optional is silly.
Diffstat (limited to 'src/libexpr/attr-set.hh')
-rw-r--r-- | src/libexpr/attr-set.hh | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libexpr/attr-set.hh b/src/libexpr/attr-set.hh index d6af99912..118c7bd5d 100644 --- a/src/libexpr/attr-set.hh +++ b/src/libexpr/attr-set.hh @@ -64,12 +64,12 @@ public: return end(); } - std::optional<Attr *> get(const Symbol & name) + Attr * get(const Symbol & name) { Attr key(name, 0); iterator i = std::lower_bound(begin(), end(), key); if (i != end() && i->name == name) return &*i; - return {}; + return nullptr; } Attr & need(const Symbol & name, const Pos & pos = noPos) @@ -77,7 +77,7 @@ public: auto a = get(name); if (!a) throw Error("attribute '%s' missing, at %s", name, pos); - return **a; + return *a; } iterator begin() { return &attrs[0]; } |