I am looking at C++ code that looks like this :
template<开发者_JAVA百科;class A>
bool foo(int A::*)
{ /*blah*/ }
What is the int A::* construct? What requirement does it impose on the type A?
Thanks a lot!!
int A::* is a pointer to an int data member of type A. E.g., given the types:
struct Foo { int i; };
struct Bar { double d; };
int Foo::*is a pointer to anintdata member of typeFoo, whose only valid values are null and the address ofFoo::iint Bar::*is a pointer to anintdata member of typeBar, whose only valid value is null, asBarcontains nointdata members
The only requirement imposed on type A is that it is not a primitive type, as primitive types obviously cannot have data members.
加载中,请稍侯......
精彩评论