Align Braces of Single Line Methods with clang format

Viewed 263

Say I have the following C++ code:

class Foo
{
   auto foo() { return 0; } // foo
   auto foofoo() const { return 1000; } // foofoo
   int bar() const { return 42; } // bar
};

How can I get clang-format for align the braces (and comments too):

class Foo
{
   auto foo()          { return 0;    } // foo
   auto foofoo() const { return 1000; } // foofoo
   int  bar()    const { return 42;   } // bar
   //            ^-----^--------------^  ALIGNED
};

(In fact, it would be nice to align consecutive method (const) qualifiers as well).

0 Answers
Related