Thomas Haupt
08/23/2009 5:03 AM
post36475
|
Hi Mario,
debugging your example, I see vector::resize( size_type _Newsize, _Ty _Val ) taking 340024 bytes of stack.
Looking into the "vector" header file, I think these come from 2 temporary ForFun objects being created in the course of
resizing.
First, the method vector::resize( size_type _Newsize ) does
vector::resize( _Newsize, _Ty() ); [line 605]
which means the second argument (a ForFun in your case) will be created on the stack.
The latter resize(), when expanding the vector, calls _Insert_n(), which itself uses a temporary variable:
_Ty _Tmp = Val; [line 1020]
These two together seem to perfectly explain your stack requirements.
Things like this always remind me what I hate about C++...
Cheers,
- Thomas
|
|
|