This is an automated email from the ASF dual-hosted git repository.
tison pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/opendal.git
The following commit(s) were added to refs/heads/main by this push:
new e49dc4600 chore: sync cpp example (#5944)
e49dc4600 is described below
commit e49dc4600151d0208937688eed3e40161a0634d5
Author: Mingzhuo Yin <[email protected]>
AuthorDate: Fri Apr 4 17:18:55 2025 +0800
chore: sync cpp example (#5944)
Signed-off-by: Mingzhuo Yin <[email protected]>
---
examples/cpp/basic.cpp | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/examples/cpp/basic.cpp b/examples/cpp/basic.cpp
index 1652e2670..8fc52f824 100644
--- a/examples/cpp/basic.cpp
+++ b/examples/cpp/basic.cpp
@@ -5,11 +5,10 @@
#include <iostream>
int main() {
- char s[] = "memory";
std::vector<uint8_t> data = {'a', 'b', 'c'};
// Init operator
- opendal::Operator op = opendal::Operator(s);
+ opendal::Operator op = opendal::Operator("memory");
// Write data to operator
op.write("test", data);
@@ -19,8 +18,8 @@ int main() {
// Using reader
auto reader = op.reader("test");
- opendal::ReaderStream stream(reader);
+ opendal::ReaderStream stream(std::move(reader));
std::string res2;
stream >> res2; // res2 == "abc"
- std::cout<<res2<<std::endl;
-}
\ No newline at end of file
+ std::cout << res2 << std::endl;
+}