diff options
| author | Egor Tensin <egor@tensin.name> | 2026-06-13 21:10:58 +0200 |
|---|---|---|
| committer | Egor Tensin <egor@tensin.name> | 2026-06-13 21:19:12 +0200 |
| commit | 8c4e17dbec3f443ec9a8dd04729f9503c1f758ad (patch) | |
| tree | 5dd5b1c6ec0436f95e7b29203ed9d1cbcc7e14aa /client | |
| parent | upgrade to <filesystem> (diff) | |
| download | math-server-8c4e17dbec3f443ec9a8dd04729f9503c1f758ad.tar.gz math-server-8c4e17dbec3f443ec9a8dd04729f9503c1f758ad.zip | |
upgrade to std::format
Diffstat (limited to 'client')
| -rw-r--r-- | client/client.hpp | 3 | ||||
| -rw-r--r-- | client/main.cpp | 3 | ||||
| -rw-r--r-- | client/settings.hpp | 5 |
3 files changed, 7 insertions, 4 deletions
diff --git a/client/client.hpp b/client/client.hpp index 4c6894e..acf3e8c 100644 --- a/client/client.hpp +++ b/client/client.hpp @@ -9,6 +9,7 @@ #include "settings.hpp" #include "transport.hpp" +#include <format> #include <iostream> #include <string> #include <utility> @@ -26,7 +27,7 @@ public: void run() { m_input_reader->for_each_input([this](const std::string& input) { m_transport->send_query(input, [](const std::string& reply) { - std::cout << reply << '\n'; + std::cout << std::format("{}\n", reply); }); return true; }); diff --git a/client/main.cpp b/client/main.cpp index 7e9b4b1..2b47f7e 100644 --- a/client/main.cpp +++ b/client/main.cpp @@ -9,6 +9,7 @@ #include <boost/program_options.hpp> #include <exception> +#include <format> #include <iostream> int main(int argc, char* argv[]) { @@ -29,7 +30,7 @@ int main(int argc, char* argv[]) { return 1; } } catch (const std::exception& e) { - std::cerr << "An error occured: " << e.what() << "\n"; + std::cerr << std::format("An error occured: {}\n", e.what()); return 1; } catch (...) { std::cerr << "An unknown error occured\n"; diff --git a/client/settings.hpp b/client/settings.hpp index 3c8d6aa..6481a21 100644 --- a/client/settings.hpp +++ b/client/settings.hpp @@ -11,6 +11,7 @@ #include <exception> #include <filesystem> +#include <format> #include <iostream> #include <string> #include <vector> @@ -94,7 +95,7 @@ public: } void usage_error(const std::exception& e) const { - std::cerr << "usage error: " << e.what() << '\n'; + std::cerr << std::format("usage error: {}\n", e.what()); std::cerr << *this; } @@ -112,7 +113,7 @@ private: Settings m_settings; friend std::ostream& operator<<(std::ostream& os, const SettingsParser& parser) { - os << "usage: " << parser.m_prog_name << ' ' << get_short_description() << '\n'; + os << std::format("usage: {} {}\n", parser.m_prog_name, get_short_description()); os << parser.m_visible; return os; } |
