Review generated header label helper

from Namespaces
C++23 advanced 6 min 4 issues to find

Review this generated header-only helper against the requested contract.

Provide acme::text::label in a header, maintain one program-wide call count, avoid namespace pollution, and construct labels efficiently.

C++
#pragma once

#include <string>
#include <string_view>

using namespace std;

namespace acme::text {
namespace {
int calls = 0;
}

string label(string_view route) {
    ++calls;
    return "[" + string(route) + "]";
}

int call_count() {
    return calls;
}
}

generated code is illustrative, not from any one model

Open in playground
Report an error