1

Our organization is looking to standardize the way we use const T& and T const& and while we initially looked at clang-format to solve the job, it doesn't reorder tokens so there is no way to swap const and T.

Does anyone have an idea as to how I can reorder these systematically?

4
  • Hi and welcome. Why not use a simple search and replace with a regex? Commented Feb 3, 2017 at 22:43
  • 3
    So you are going introduce a risk of breaking something by introducing a change which does not really improve the readabilty of the code, just make it a little bit more consistent? Sure it will be worth the hassle? Commented Feb 3, 2017 at 22:49
  • 2
    I'm not sure if it is worth the hassle. If the answer is sed magic followed by clang format, I'm too afraid of making a mistake by the changing something in a string context or messing up with a const function. If there is a tool that does this already then it might be worth the hassle. Commented Feb 4, 2017 at 3:10
  • I'm sure that the more intrusive Clang tools (modernize) can perform this transformation. But I have no experience in using them. Commented Feb 4, 2017 at 4:49

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.