diff options
author | Jisi Liu <jisi.liu@gmail.com> | 2016-03-29 15:25:49 -0700 |
---|---|---|
committer | Jisi Liu <jisi.liu@gmail.com> | 2016-03-29 15:25:49 -0700 |
commit | e164f1083fd08e61bbad9c79a37058f1aeca4086 (patch) | |
tree | f264547a040ca129ba4f23aaf3a80b48f412c02d /src | |
parent | 261ee021f640ea6fe67aaf1f53e1518ed154cad0 (diff) | |
download | protobuf-e164f1083fd08e61bbad9c79a37058f1aeca4086.tar.gz protobuf-e164f1083fd08e61bbad9c79a37058f1aeca4086.tar.bz2 protobuf-e164f1083fd08e61bbad9c79a37058f1aeca4086.zip |
Use the T() instead of NULL for the default value.
The template can be specialized on primitives, e.g. double, where
converting NULL will trigger a warning.
Diffstat (limited to 'src')
-rw-r--r-- | src/google/protobuf/stubs/statusor.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/google/protobuf/stubs/statusor.h b/src/google/protobuf/stubs/statusor.h index ad848701..29f869ad 100644 --- a/src/google/protobuf/stubs/statusor.h +++ b/src/google/protobuf/stubs/statusor.h @@ -224,7 +224,7 @@ inline StatusOr<T>& StatusOr<T>::operator=(const StatusOr<T>& other) { template<typename T> template<typename U> inline StatusOr<T>::StatusOr(const StatusOr<U>& other) - : status_(other.status_), value_(other.status_.ok() ? other.value_ : NULL) { + : status_(other.status_), value_(other.status_.ok() ? other.value_ : T()) { } template<typename T> |