I don't think you can do anything like that. foos[2]
is not a member of bar
, only foos
is. You cannot get a pointer-to-member from something which is not a member. Paragraph 5.3.1/4 of the C++11 Standard specifies:
A pointer to member is only formed when an explicit
&
is used and its operand is a qualified-id not enclosed in parentheses.
This means the grammar itself prevents you from writing anything that does not look like:
&class_name::member_name
where class_name
could itself be a qualified name. No subscript operator or other fancy notation is allowed.