
Hi,
I believe the general idea has been around for years [1]. I wonder if a utility like this gets accepted to Boost. You have my interest.
I think you can save a few more lines of code in the headers by separating some of the member functions of fwd (like the constructors and the destructor) into another header file, that will only get included in .cpp files.
There is a trade off between lines of code an 'number of files loaded'. But I think you are right it could be split out. As I think of more features to add to fwd this becomes important. In my latest test I show how operators can be transparently supported. fwd only solves the problem for some classes. Classes like std::string pose a bigger challenge because they cannot be forward declared even if all you want to use is a std::string* because it is really a template / typedef. My partial solution was to attempt a class that was 'reinterpret_castable' to std string. Simply including <string> adds 4000+ lines of code to the build. Including my string.hpp adds 61 lines and is sufficient for 95% of the usage of std::string (I would finish out the interface to mirror most of std::string) leaving only a few edge cases. where std::string would be required. In the .cpp it would use the real string to implement everything.
Cheers, Kris
[1] http://www.gotw.ca/gotw/028.htm
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost