It would help if you'd quote correctly, so we knew what you're
actually talking about.
maybe I'm using a compiler which is some 10 years old and
therefore doesn't recognize this construct, but I do not too.
I doubt it has anything to do with the age of the compiler.
It's been around since the beginning.
First, the variable "i" declared inside X as int is not
static, therefore X::i has no meaning to me and neither &X::i.
Why not? Both have meaning, regardless of whether the i is
static or not. Just about any C++ text should have talked about
X::i; it's a common idiom (although more often used with
functions, e.g. X::f()). Pointers to members are a bit more
exotic, but a good explination of the language will at least
mention them.
Second, I would expect on the left side of the equal a type,
plus an identifier name, but "int X::*" is not a type to me.
It is to the language.
Explain what? In the expression X::i, the :: is a scope
resolution operator; it limits lookup and name resolution to
things that are visible in the scope of X (basically, X and its
base classes). Probably the most frequent use of this operator
(at least with a class on the left side) is to call a base class
function which we are extending, e.g.:
class Base
{
public:
virtual void f() ;
} ;
class Derived
{
public:
virtual void f() { Base::f() ; ... }
} ;
(I don't particularly like this idiom, but it is widespread.)
But it also works with variables, provided the variable is
accessible in the scope it is being used, e.g.
struct Base
{
int i ;
} ;
struct Derived
{
int i ;
} ;
Derived* pi ;
pi->Base::i = 3 ;
assigns to the i in the base class.
In the declaration, ::* signifies pointer to (non-static)
member. Syntactically, it works more or less like * for
pointer, except that you have to say member of what. So the
syntax is <classname> ::* (two tokens, except that the class
name can be qualified, and thus more than one token). A pointer
to member isn't really a pointer in the classical sense; it's a
selector which allows us to access a dynamically chosen member,
given an object of the class type, e.g.:
struct S
{
int i ;
int j ;
int k ;
} ;
S* p = new S ;
int S::*pm = &S::i ;
p->*pm = 1 ; // equivalent to p->i = 1
pm = &S::j ;
p->*pm = 2 ; // equivalent to p->j = 2
pm = &S::k ;
p->*pm = 3 ; // equivalent to p->k = 3
I'd say that pointers to members are fairly rare, but I've used
them once or twice (in over 15 years C++).
Note that outside of S, the expression &i has no meaning. If
you take the address of a qualified name, however, such as
&S::i, the result isn't a simple pointer (int*), but a pointer
to member (int S::*), which requires an instance to S in order
to be used. (Practically, except for comparison and assignment,
it is only valid on the right side of a pointer to member
operator, i.e. object.*i or pointer->*i.)