c++ - Forward declaration in multiple source directory; template instantation -
I'm looking for a good book, reference material that is related to further announcement of classes. When sources are in multiple directories, for example, class A in DIAR has been declared in DIERB in Class B? How is this done?
In addition, template issues, advanced uses and immediate problems, any content for excessive praise?
Thank you.
Further announcements do nothing with the directory structure of your project, you have not declared anything present in your project can do. They are used to resolve cyclical references between most classes and to speed up the compilation, when the full class declaration is not necessary, and related #include can be replaced with further announcements.
Enough, sizeof () queries can usually answer the question. For example,
square wheel; Square car {wheel wheels [4]; };
In this announcement, further announcements can not be used because the compiler can not determine the size of the car: it does not know how much data is in the wheels. In other words, sizeof (car)
is unknown.
In addition to the templates, the forthcoming sections can not be used as template parameters if the template class has template class data subscribers but they can be indicated). For example,
template & lt; Class T & gt; Class Pointer {T * PTR; }; Class test; The indicator's & lt; Test & gt; Testpointer;
is legal but
std :: vector & lt; Test & gt; TestVector will not compile
Due to the above limitations, the declared sections on the front side are usually used as signs or references.
I do not know if there is a book on this subject, but you can see C ++ on Lights often.
Comments
Post a Comment