Why do STL-Datastructures need fully defined types?

The short answer is: because the standard says so. More generally, depending on the implementation, and what each type and function does, instantiating a template may require a complete definition. The authors of the standard either didn't want to, or didn't have time to analyse and specify in detail in what cases they didn't want to require complete definitions, and settled for a blanket statement.

Note too that when the standard was written, there was relatively little experience with STL, and one could be sure that there wasn't some clever optimization which would require an instance of the argument type within a class; rather than risk banning such an optimization, it seemed safer to require a complete type.

At least one problem your compiler faces with incomplete types is that it might be unable to fully determine the size of your struct Test. And thus, how could some container internally instantiate a Test?

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions