diff --git a/google/cloud/storage/examples/storage_object_samples.cc b/google/cloud/storage/examples/storage_object_samples.cc index a7ee4e756860c..ff2a241cc6cc4 100644 --- a/google/cloud/storage/examples/storage_object_samples.cc +++ b/google/cloud/storage/examples/storage_object_samples.cc @@ -322,8 +322,8 @@ void ReadObjectIntoMemory(google::cloud::storage::Client client, [](gcs::Client client, std::string const& bucket_name, std::string const& object_name) { gcs::ObjectReadStream stream = client.ReadObject(bucket_name, object_name); - std::string buffer{std::istream_iterator(stream), - std::istream_iterator()}; + std::string buffer{std::istreambuf_iterator(stream), + std::istreambuf_iterator()}; if (stream.bad()) throw google::cloud::Status(stream.status()); std::cout << "The object has " << buffer.size() << " characters\n"; @@ -340,7 +340,7 @@ void ReadObjectGzip(google::cloud::storage::Client client, std::string const& object_name) { auto is = client.ReadObject(bucket_name, object_name, gcs::AcceptEncodingGzip()); - auto const contents = std::string{std::istream_iterator(is), {}}; + auto const contents = std::string{std::istreambuf_iterator(is), {}}; if (is.bad()) throw google::cloud::Status(is.status()); std::cout << "The object has " << contents.size() << " characters\n"; }