| Index: webrtc/base/optional.h
|
| diff --git a/webrtc/base/optional.h b/webrtc/base/optional.h
|
| index b8071e635876b1b42b4bb7d6b6c10b417d25ad7e..5c89c9c22f5e61abbf4fa1c5e4c3a0babb950972 100644
|
| --- a/webrtc/base/optional.h
|
| +++ b/webrtc/base/optional.h
|
| @@ -13,7 +13,7 @@
|
|
|
| #include <algorithm>
|
| #include <utility>
|
| -
|
| +#include <ostream>
|
| #include "webrtc/base/checks.h"
|
|
|
| namespace rtc {
|
| @@ -134,6 +134,18 @@ class Optional final {
|
| bool has_value_;
|
| };
|
|
|
| +// Defines the operator to write Optional<T> to an output stream. Allows for
|
| +// simplified logging of optional parameters.
|
| +template <typename T>
|
| +std::ostream& operator<<(std::ostream& stream, rtc::Optional<T> value) {
|
| + if (value) {
|
| + stream << *value;
|
| + } else {
|
| + stream << "<not set>";
|
| + }
|
| + return stream;
|
| +}
|
| +
|
| } // namespace rtc
|
|
|
| #endif // WEBRTC_BASE_OPTIONAL_H_
|
|
|