First, if you define them directly in the header, I would suggest using extern const instead and then defining them in the cpp file:
//in .hpp: extern const std::string foo; //in .cpp: const std::string foo = "FOO";
Thus, at least the definitions can be changed without restoration.
Secondly, study where they are included. If the permalink is included in the low-level header, is it possible to include include in cpp instead? Removing it can lead to a decrease in communication, so he does not need to restore so much.
Thirdly, open this file. I would suggest displaying the structure that you ultimately want, start adding new constants to the new structure instead of the old one. In the end (when you are sure that you have the structure you want), reformat the old file to the new structure and make the old file included with the whole structure. Finally, go through and delete everything included in the old file, pointing them to the corresponding new sections. This will break the refactoring, so you donβt have to do it all at once.
And fourthly, you can trick your compiler to not rebuild if the header file changes. You will need to check the documentation of your compiler, and this may be unsafe, so you sometimes want to add complete assemblies as well.
Todd gardner
source share