| Index: base/optional.h
|
| diff --git a/base/optional.h b/base/optional.h
|
| index b468964ae339fbead38f769dd315ff39a008d054..2e322dee6d785e6caca8740abb4f2bc44f468176 100644
|
| --- a/base/optional.h
|
| +++ b/base/optional.h
|
| @@ -5,6 +5,7 @@
|
| #ifndef BASE_OPTIONAL_H_
|
| #define BASE_OPTIONAL_H_
|
|
|
| +#include <ostream>
|
| #include <type_traits>
|
|
|
| #include "base/logging.h"
|
| @@ -436,6 +437,16 @@ constexpr Optional<typename std::decay<T>::type> make_optional(T&& value) {
|
| return Optional<typename std::decay<T>::type>(std::forward<T>(value));
|
| }
|
|
|
| +// For logging use only.
|
| +template <class T>
|
| +std::ostream& operator<<(std::ostream& os, const Optional<T>& opt) {
|
| + if (opt)
|
| + os << opt.value();
|
| + else
|
| + os << "(unset)";
|
| + return os;
|
| +}
|
| +
|
| template <class T>
|
| void swap(Optional<T>& lhs, Optional<T>& rhs) {
|
| lhs.swap(rhs);
|
|
|