From 64d52f7418b3335ff8f49080d3180eaa2abef4e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com> Date: Sun, 1 Nov 2015 18:00:08 -0500 Subject: [PATCH] tools: more constness --- tools/tools_common.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/tools_common.h b/tools/tools_common.h index c722d2ea..4c7af5e2 100644 --- a/tools/tools_common.h +++ b/tools/tools_common.h @@ -56,19 +56,19 @@ namespace Color { BG_DEFAULT = 49 }; class Modifier { - Code code; + const Code code; public: - Modifier(Code pCode) : code(pCode) {} + constexpr Modifier(Code pCode) : code(pCode) {} friend std::ostream& operator<<(std::ostream& os, const Modifier& mod) { - return os << "\033[" << mod.code << "m"; + return os << "\033[" << mod.code << 'm'; } }; } -const Color::Modifier def(Color::FG_DEFAULT); -const Color::Modifier red(Color::FG_RED); -const Color::Modifier yellow(Color::FG_YELLOW); +constexpr const Color::Modifier def(Color::FG_DEFAULT); +constexpr const Color::Modifier red(Color::FG_RED); +constexpr const Color::Modifier yellow(Color::FG_YELLOW); /** * Print va_list to std::ostream (used for logging). @@ -145,7 +145,7 @@ struct dht_params { std::pair<std::string, std::string> bootstrap {}; }; -static const struct option long_options[] = { +static const constexpr struct option long_options[] = { {"help", no_argument, nullptr, 'h'}, {"port", required_argument, nullptr, 'p'}, {"bootstrap", optional_argument, nullptr, 'b'}, -- GitLab