diff options
Diffstat (limited to 'include/llvm/ADT/Optional.h')
-rw-r--r-- | include/llvm/ADT/Optional.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/llvm/ADT/Optional.h b/include/llvm/ADT/Optional.h index ee8b69f..f43aeb1 100644 --- a/include/llvm/ADT/Optional.h +++ b/include/llvm/ADT/Optional.h @@ -16,8 +16,13 @@ #ifndef LLVM_ADT_OPTIONAL #define LLVM_ADT_OPTIONAL +#include "llvm/Support/Compiler.h" #include <cassert> +#if LLVM_USE_RVALUE_REFERENCES +#include <utility> +#endif + namespace llvm { template<typename T> @@ -28,6 +33,10 @@ public: explicit Optional() : x(), hasVal(false) {} Optional(const T &y) : x(y), hasVal(true) {} +#if LLVM_USE_RVALUE_REFERENCES + Optional(T &&y) : x(std::forward<T>(y)), hasVal(true) {} +#endif + static inline Optional create(const T* y) { return y ? Optional(*y) : Optional(); } |