From b09db0325d29daec35267677849f31ac3f341858 Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Fri, 18 Sep 2020 11:23:43 +0200 Subject: [PATCH] Use fmtlib for string formatting in opmhash --- examples/opmhash.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/examples/opmhash.cpp b/examples/opmhash.cpp index 39e44c911..030e8122d 100644 --- a/examples/opmhash.cpp +++ b/examples/opmhash.cpp @@ -18,10 +18,10 @@ */ #include -#include -#include #include +#include + #include #include #include @@ -85,12 +85,11 @@ std::size_t deck_hash(const std::vector& keywords) { void print_keywords(const std::vector& keywords, bool location_info) { for (const auto& kw : keywords) { if (location_info) - std::cout << std::setw(8) << std::left << kw.name << " : " << kw.filename << ":" << kw.line_number << " " << kw.content_hash << std::endl; + fmt::print("{:8s} : {}:{} {} \n", kw.name, kw.filename, kw.line_number, kw.content_hash); else - std::cout << std::setw(8) << std::left << kw.name << " : " << kw.content_hash << std::endl; + fmt::print("{:8s} : {} \n", kw.name, kw.content_hash); } - std::cout << std::endl; - std::cout << std::setw(8) << std::left << "Total" << " : " << deck_hash(keywords) << std::endl; + fmt::print("\n{:8s} : {}\n", "Total", deck_hash(keywords)); }