node icon indicating copy to clipboard operation
node copied to clipboard

`cpplint` does not accept literals that require namespace

Open anonrig opened this issue 1 year ago • 0 comments

Literals such as std::string_view::string_view_literals or std::literals::string_view_literals is required to be used through a namespace. The following code is the only way of achieving that:

using namespace std::string_view::string_view_literals

Currently, cpplint does not accept this example, and forces us to add a ignore statement, and using-declarations are not available for string_view_literals.

src/node_options.cc:20:  Do not use namespace using-directives.  Use using-declarations instead.  [build/namespaces_literals] [5]

One way of achieving this through:

using std::string_view_literals::operator""sv;.

cc @nodejs/cpp-reviewers

anonrig avatar Jun 22 '23 19:06 anonrig