> Hi C++ experts!
>
> Definitely I skipped C/C++ 101 because I have this pitfall:
>
> I need to call the struct ctor in the class default ctor body see
> below:
Add an explicitly defined default constructor to your struct that does the
initialization:
> //Some.h
#include <algorithm>
> struct MyStruct
>
> {
> int a[5];
MyStruct()
{
std::fill(a,a+sizeof(a),0);
}
> };
HTH
-cd
Vladimir Nesterovsky - 18 Dec 2004 16:52 GMT
> Add an explicitly defined default constructor to your struct that does the
> initialization:
[quoted text clipped - 10 lines]
> MyStruct()
> {
std::fill(a,a+5,0);
> }
> > };
--
Vladimir Nesterovsky
e-mail: vladimir@nesterovsky-bros.com
home: http://www.nesterovsky-bros.com
Carl Daniel [VC++ MVP] - 19 Dec 2004 03:32 GMT
> std::fill(a,a+5,0);
Yeah, that'd be better ;-) Or maybe even :
std::fill(a,a+sizeof(a)/sizeof(a[0]),0);
-cd
Karl M - 19 Dec 2004 13:21 GMT
Thank you guys,
See my new post regarding the struct ctor
Karl M