OSDN Git Service

Add an emplace(...) method to llvm::Optional<T>.
authorJordan Rose <jordan_rose@apple.com>
Wed, 1 Oct 2014 02:12:35 +0000 (02:12 +0000)
committerJordan Rose <jordan_rose@apple.com>
Wed, 1 Oct 2014 02:12:35 +0000 (02:12 +0000)
commit771ac70aed5efb591a78d22b44a4589183e6c3f0
tree4ee6da27fdb0d53f78f10797367643763c438758
parent06c13730536269a70e61e6729927c8a04d0ad471
Add an emplace(...) method to llvm::Optional<T>.

This can be used for in-place initialization of non-moveable types.
For compilers that don't support variadic templates, only up to four
arguments are supported. We can always add more, of course, but this
should be good enough until we move to a later MSVC that has full
support for variadic templates.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218732 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/ADT/Optional.h
unittests/ADT/OptionalTest.cpp