THRIFT-5766 Replace std::endl with "\n"
Patch: Carel Combrink
This closes #2943
diff --git a/tutorial/cpp/CppClient.cpp b/tutorial/cpp/CppClient.cpp
index 5208411..02e7b17 100644
--- a/tutorial/cpp/CppClient.cpp
+++ b/tutorial/cpp/CppClient.cpp
@@ -43,9 +43,9 @@
transport->open();
client.ping();
- cout << "ping()" << endl;
+ cout << "ping()" << '\n';
- cout << "1 + 1 = " << client.add(1, 1) << endl;
+ cout << "1 + 1 = " << client.add(1, 1) << '\n';
Work work;
work.op = Operation::DIVIDE;
@@ -54,27 +54,27 @@
try {
client.calculate(1, work);
- cout << "Whoa? We can divide by zero!" << endl;
+ cout << "Whoa? We can divide by zero!" << '\n';
} catch (InvalidOperation& io) {
- cout << "InvalidOperation: " << io.why << endl;
- // or using generated operator<<: cout << io << endl;
- // or by using std::exception native method what(): cout << io.what() << endl;
+ cout << "InvalidOperation: " << io.why << '\n';
+ // or using generated operator<<: cout << io << '\n';
+ // or by using std::exception native method what(): cout << io.what() << '\n';
}
work.op = Operation::SUBTRACT;
work.num1 = 15;
work.num2 = 10;
int32_t diff = client.calculate(1, work);
- cout << "15 - 10 = " << diff << endl;
+ cout << "15 - 10 = " << diff << '\n';
// Note that C++ uses return by reference for complex types to avoid
// costly copy construction
SharedStruct ss;
client.getStruct(ss, 1);
- cout << "Received log: " << ss << endl;
+ cout << "Received log: " << ss << '\n';
transport->close();
} catch (TException& tx) {
- cout << "ERROR: " << tx.what() << endl;
+ cout << "ERROR: " << tx.what() << '\n';
}
}
diff --git a/tutorial/cpp/CppServer.cpp b/tutorial/cpp/CppServer.cpp
index 635afef..4c66cb8 100644
--- a/tutorial/cpp/CppServer.cpp
+++ b/tutorial/cpp/CppServer.cpp
@@ -48,15 +48,15 @@
public:
CalculatorHandler() = default;
- void ping() override { cout << "ping()" << endl; }
+ void ping() override { cout << "ping()" << '\n'; }
int32_t add(const int32_t n1, const int32_t n2) override {
- cout << "add(" << n1 << ", " << n2 << ")" << endl;
+ cout << "add(" << n1 << ", " << n2 << ")" << '\n';
return n1 + n2;
}
int32_t calculate(const int32_t logid, const Work& work) override {
- cout << "calculate(" << logid << ", " << work << ")" << endl;
+ cout << "calculate(" << logid << ", " << work << ")" << '\n';
int32_t val;
switch (work.op) {
@@ -95,11 +95,11 @@
}
void getStruct(SharedStruct& ret, const int32_t logid) override {
- cout << "getStruct(" << logid << ")" << endl;
+ cout << "getStruct(" << logid << ")" << '\n';
ret = log[logid];
}
- void zip() override { cout << "zip()" << endl; }
+ void zip() override { cout << "zip()" << '\n'; }
protected:
map<int32_t, SharedStruct> log;
@@ -172,8 +172,8 @@
threadManager);
*/
- cout << "Starting the server..." << endl;
+ cout << "Starting the server..." << '\n';
server.serve();
- cout << "Done." << endl;
+ cout << "Done." << '\n';
return 0;
}