A
amparikh
I have some test code which demonstrates the problem. I know I could
solve this by just returning a pointer, but I better use a reference.
In real code, what I actually want to return is a reference to an array
of function pointers. But the code below is good enough to show the
problem.
Thanks.
#define MAX_DEC 11
static char (&MyFunc())[MAX_DEC]
{
static char init[] = "Hihowareya";
return init;
}
class A
{
private :
char (&Ptr)[MAX_DEC];
public:
A() : Ptr:MyFunc())
{
}
};
int main()
{
A a;
}
The error I get is "'A:tr' : initialization of reference member
requires a temporary variable"
solve this by just returning a pointer, but I better use a reference.
In real code, what I actually want to return is a reference to an array
of function pointers. But the code below is good enough to show the
problem.
Thanks.
#define MAX_DEC 11
static char (&MyFunc())[MAX_DEC]
{
static char init[] = "Hihowareya";
return init;
}
class A
{
private :
char (&Ptr)[MAX_DEC];
public:
A() : Ptr:MyFunc())
{
}
};
int main()
{
A a;
}
The error I get is "'A:tr' : initialization of reference member
requires a temporary variable"