Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I automatically sort methods by header?

Tags:

It is good style to sort methods in header files in the same order as in the .cpp file, but often this order gets crude during development.

How can I reorder the methods in the cpp file to the order given in the header file?

like image 867
Gerrit Avatar asked Oct 11 '10 13:10

Gerrit


1 Answers

I've found it effective to use a graphical diff tool to show the header and source file side by side to keep the documentation in sync and make sure everything's in the same order. (My employer bought me Araxis Merge, so that's what I use, but there are a variety of free and commercial tools that accomplish the same thing on a variety of platforms.)

This might be easier with a procedural C or C++ file, as opposed to an object-oriented C++ file where class member functions would have a different indentation level in the header than in the source file.

like image 90
Commodore Jaeger Avatar answered Sep 23 '22 07:09

Commodore Jaeger