C ++ is still an evolving language, and new features are added to this as part of the development of C ++ 0x.
The C ++ 11 standard has already been approved and published , so there are no more functions added to it. Not for at least a few more years.
One of the features that I missed badly in C ++ is the correct module concept: the current approach using header files (where you use the conditional #define to make sure the header is not included twice) seems definitely unsatisfactory to me.
Some compilers support #pragma once to avoid the need to write included guards, but as far as I know, it is non-standard. There are situations when you do not want to include guards; Boost.Preprocessor is an example library with some headers that intentionally do not contain defenders.
For example, in my project there is a problem that we have too many “#include” in many source files, which makes the compilation time unreasonably long: it takes 45 minutes to create our product using Incredibuild, i.e. Using at least 10 cores in parallel. Therefore, we will have to spend a lot of time cleaning the files manually, i.e. removal includes to check if they are really necessary.
Stroustrup has a record of frequently asked questions about slow compilation . Also read the GotW # 7 article on including header files. It is very likely that you have included more files than necessary. For example, you can get away with advanced ads. If you have huge header files, you can try to split them so that your sources include only those ads that you really need. Perhaps this is due to the fact that your file structure does not contribute to fast compilation.
1. clearly separate the interface from the implementation of the module;
We have the PIMPL idiom (also known as compilation firewall). And even without this, I have no problems with the implementation in the .cpp file and the interface in the .h file (although this is not a "clean" interface).
2. connect the interface and the module body separately (currently .h files are compiled again and again each time they are included in other files): the tool can then read the compiled interface and indicate what types, functions, classes it exports;
Some compilers support precompiled header files that you can use.
3.write tools to automatically rearrange imports easier.
I do not understand what you mean by that.
Do you think that you can define such a concept for a module and integrate it into C ++ or will it be too complicated? Do you know what efforts are in this direction?
Believe it or not, there is a suggestion to add some kind of module concept in C ++, but it was not accepted in C ++ 11 because of (they worked and considered other sentences, such as rvalue links, which in my opinion , much more important). It may be included in the next version or update of the C ++ standard.