Skip to content

Commit 3742b25

Browse files
committed
Optional: add value_or() helper
Signed-off-by: Roman Lebedev <[email protected]>
1 parent 34e2a63 commit 3742b25

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/librawspeed/adt/Optional.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ template <typename T> class Optional final {
8787

8888
explicit operator bool() const { return has_value(); }
8989

90+
template <typename U> T value_or(U&& fallback) const& {
91+
return impl.value_or(std::forward<U>(fallback));
92+
}
93+
9094
void reset() { impl.reset(); }
9195
};
9296

0 commit comments

Comments
 (0)