I'm trying to get the benefits of splitting without two files. Split compilation without splitting storage.
I understand the benefits of separating .h and .cpp files, but I really dislike having the files be separate, specifically when the classes are tiny and each file could fit on the same page.
Is there a precompiler option, or perhaps any other trick which would allow me to keep the benefits of separation, while having the text all in the same place? For example:
EDIT: please do not focus too much on this example. It was meant to show off an imaginary pre-processor arg #CPP_SPLIT
. The actual code is unimportant, please, please ignore it.
// TinyClass.h
class TinyClass {
TinyClass();
int answerToLife();
}
// the following is a fake compiler arg
// in this example it would be totally unnecessary,
// but many of my classes have some form of circular referencing
// and can not include all the code in the .h file
#CPP_SPLIT
TinyClass::TinyClass() {}
TinyClass::answerToLife() { return 42; }
#CPP_SPLIT_END