W
W Karas
1)
Support the idiom:
p - static_cast<C::*M>(p)
C is a class.
M is a data member of C (not a type).
The value of p must implicitly convert to the type of M.
If the value of p (after conversion) is the address of
the member M of some instance of C, the result
of the "expression" has type C * and is the address of
the instance of C. Otherwise, the result is undefined.
This idiom could be supported directly, or by
allowing C::*M as a new sort of pointer, that
would only have default and copy constructors,
assignment. Otherwise only usable in this
weird new overload of -.
2)
Allow
class X.Y ... ;
to indicate that class Y can only be used as the
type of data members of class X. If Y is member
of class X, X can be omitted:
class .Y ... ;
Support the idiom:
p - static_cast<C::*M>(p)
C is a class.
M is a data member of C (not a type).
The value of p must implicitly convert to the type of M.
If the value of p (after conversion) is the address of
the member M of some instance of C, the result
of the "expression" has type C * and is the address of
the instance of C. Otherwise, the result is undefined.
This idiom could be supported directly, or by
allowing C::*M as a new sort of pointer, that
would only have default and copy constructors,
assignment. Otherwise only usable in this
weird new overload of -.
2)
Allow
class X.Y ... ;
to indicate that class Y can only be used as the
type of data members of class X. If Y is member
of class X, X can be omitted:
class .Y ... ;