-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Description
I just would like to ask what the general consent about double includes in the cpp and header file of the same class is.
Lets say i have a function that returns e.g. a std::string (declared in header, defined in source file), i am currently forced to #include both, in the header and the cpp file. If i only include it in the header misc-include-cleaner will issue a warning, that no header providing "std::string" is directly included.
Now for my understanding, only including it in the header of the same class (meaning cpp and h file have the exact same name) is perfectly fine (or even preferred over double the includes).
I understand that the warning is useful for anything else (meaning not the exact case above).
Whats the general opinion on this. Might the check be adjusted in a way, that the above usecase does not issue a warning (or maybe even make it configurable)? Or is the general opinion, that even in this case, the warning is useful and we shall include necessary headers in both files?