A
Agoston Bejo
Hello there,
is it possible to initialize such a static member that need some algorithm
for
initializing? What I mean is:
----------------------------------
Example: Platform VC++7.1
----------------------------------
#include <iostream>
using namespace std;
struct A {
static int ia[10];
}
for(int i=0;i<10;++i) { A::ia = i; } // SYNTAX ERROR: 'for'
int _tmain(int argc, _TCHAR* argv[])
{
cout << A::ia[5] << endl;
return 0;
}
---------------------------------
What is actually missing is a kind of "static constructor" for a class, sort
of
like in Java.
Any ways to do this?
Thx,
Agoston
is it possible to initialize such a static member that need some algorithm
for
initializing? What I mean is:
----------------------------------
Example: Platform VC++7.1
----------------------------------
#include <iostream>
using namespace std;
struct A {
static int ia[10];
}
for(int i=0;i<10;++i) { A::ia = i; } // SYNTAX ERROR: 'for'
int _tmain(int argc, _TCHAR* argv[])
{
cout << A::ia[5] << endl;
return 0;
}
---------------------------------
What is actually missing is a kind of "static constructor" for a class, sort
of
like in Java.
Any ways to do this?
Thx,
Agoston