I have the following situation
Class A
{
public:
A(/* x number of arguments */);
};
A::A(/*.....*/)
{
std::set<__int64> tmpSet;
tmpSet.insert( /*<num>*/ ); // repeat statement for some 30 K or more
tmpSet.insert( /*<num>*/ );
//-----repeat statement for some 30K or more times
}
main()
{
A obj(/*arguments */); // Run time Error : Stack over flow
}
What I observed , when I reduced the number of inserts in the constructor the Error disappeared . I wonder how did the compiler knew at run time to calculate the size of the container before the object was created .