From 02cbe139e9d428c7e51bda2e9f576e990a570dce Mon Sep 17 00:00:00 2001 From: Matej Focko Date: Sun, 23 Jul 2023 20:42:09 +0200 Subject: [PATCH] chore(cpp): use fully-qualified names MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit use fully-qualified names in the helpers instead of abusing the ‹using› Signed-off-by: Matej Focko --- .common/cpp/skeleton.cpp | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/.common/cpp/skeleton.cpp b/.common/cpp/skeleton.cpp index 2699a76..d836ae2 100644 --- a/.common/cpp/skeleton.cpp +++ b/.common/cpp/skeleton.cpp @@ -20,11 +20,9 @@ std::ostream &operator<<(std::ostream &s, std::pair const &p) { namespace helpers { -using namespace std; - namespace math { -static constexpr int32_t MODULO = 1000000007; +static constexpr std::int32_t MODULO = 1000000007; long pow(long base, long exp) { if (exp == 0) return 1; @@ -56,27 +54,22 @@ namespace output { template inline void answer(const T &ans) { - cout << ans << "\n"; + std::cout << ans << "\n"; } -inline void yes() { cout << "YES\n"; } -inline void no() { cout << "NO\n"; } - -inline void yesno(bool ans) { - if (ans) { - yes(); - } else { - no(); - } -} +inline void yes() { std::cout << "YES\n"; } +inline void no() { std::cout << "NO\n"; } +inline void yesno(bool ans) { std::cout << (ans ? "YES" : "NO") << "\n"; } } // namespace output +using namespace std; + using namespace math; using namespace input; using namespace output; -#define LOOP(n) for (auto i = 0; i < n; ++i) +#define LOOP(var, n) for (auto var = 0; var < n; ++var) } // namespace helpers