Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright 2015 The WebRTC Project Authors. All rights reserved. | |
| 3 * | |
| 4 * Use of this source code is governed by a BSD-style license | |
| 5 * that can be found in the LICENSE file in the root of the source | |
| 6 * tree. An additional intellectual property rights grant can be found | |
| 7 * in the file PATENTS. All contributing project authors may | |
| 8 * be found in the AUTHORS file in the root of the source tree. | |
| 9 */ | |
| 10 | |
| 11 #ifndef WEBRTC_BASE_OPTIONAL_IOS_H_ | |
| 12 #define WEBRTC_BASE_OPTIONAL_IOS_H_ | |
| 13 | |
| 14 #include <ostream> | |
| 15 #include "webrtc/base/optional.h" | |
| 16 | |
| 17 namespace rtc { | |
| 18 | |
| 19 // Contains function definitions to allow writing rtc::Optional<T> to ostreams. | |
| 20 // Allows for simpler logging of rtc::Optional<T> values. | |
| 21 | |
| 22 template <typename T> | |
| 23 std::ostream& operator<<(std::ostream& stream, rtc::Optional<T> value) { | |
| 24 if (value) { | |
| 25 stream << *value; | |
| 26 } else { | |
| 27 stream << "<not set>"; | |
| 28 } | |
| 29 return stream; | |
| 30 } | |
|
pthatcher1
2016/03/17 21:51:28
Can we put this in optional.h? Is the dependency
skvlad
2016/03/18 00:49:17
Ok - moved it to optional.h. The ostream dependenc
| |
| 31 | |
| 32 } // namespace rtc | |
| 33 | |
| 34 #endif // WEBRTC_BASE_OPTIONAL_IOS_H_ | |
| OLD | NEW |