R
removeps-generic
I have
struct X
{
double array[10];
};
I want to form a pointer to the 5th element of X::array. The type of
the pointer should be
"double X::*" or "double* X::*" or something along those lines.
Here is the code I tried:
struct X
{
double array[10];
double* ptr;
};
int main()
{
double (X::* junk1)[10] = &X::array; // ok
double* X::* junk2 = &X::array;
// error in all the compilers I've tried
// but if an array decays to a
// pointer to the first element of the array
// shouldn't a pointer to a an array member decay to a
// pointer to the first element of the array member?
double* X::* junk3 = &X:tr; // ok
double* X::* junk4 = &X::array[0];
// error in all the compilers I've tried
// the X::array[0] refers to the first element of the array
// but the compiler thinks the use of X::array[0] is an error
return 0;
}
struct X
{
double array[10];
};
I want to form a pointer to the 5th element of X::array. The type of
the pointer should be
"double X::*" or "double* X::*" or something along those lines.
Here is the code I tried:
struct X
{
double array[10];
double* ptr;
};
int main()
{
double (X::* junk1)[10] = &X::array; // ok
double* X::* junk2 = &X::array;
// error in all the compilers I've tried
// but if an array decays to a
// pointer to the first element of the array
// shouldn't a pointer to a an array member decay to a
// pointer to the first element of the array member?
double* X::* junk3 = &X:tr; // ok
double* X::* junk4 = &X::array[0];
// error in all the compilers I've tried
// the X::array[0] refers to the first element of the array
// but the compiler thinks the use of X::array[0] is an error
return 0;
}