How to force east const in clang format?

Viewed 1954

Is there a flag in clang-format to change 'const west' to 'east const', so that the following:

void fun(const std::string &s);

would be reformatted to:

void fun(std::string const &s);
2 Answers

As of Clang-Format 14, there is QualifierAlignment. Add the following line to your .clang-format configuration file:

QualifierAlignment: Right

AFAIK it isn't implemented yet, but there is a feature request in their bugtracker.

Related