[PATCH] Add getValueOr to llvm::Optional<T>.

Jordan Rose jordan_rose at apple.com
Fri Sep 26 11:50:09 PDT 2014


Hi dblaikie,

This takes a single argument convertible to T, and
- if the Optional has a value, returns the existing value,
- otherwise, constructs a T from the argument and returns that.

Inspired by std::experimental::optional from the "Library Fundamentals" C++ TS.

http://reviews.llvm.org/D5507

Files:
  include/llvm/ADT/Optional.h
  unittests/ADT/OptionalTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D5507.14128.patch
Type: text/x-patch
Size: 2074 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140926/e5058b0c/attachment.bin>


More information about the llvm-commits mailing list