Private members extraction
Having found Access to private members. That’s easy! , I was very impressed. But the code provided there was quite hard to read and understand, so I clarify it and make some additional explanations.
Abstract
This method allows us to retrieve pointers to private member data and functions, with one restriction: private types cannot feature in the data type / function signature.
Key idea
We employ [temp.explicit]/12 of the Working Draft from 2017-03-21 which states the following:
The usual access checking rules do not apply to names used to specify explicit instantiations. [Note: In particular, the template arguments and names used in the function declarator (including parameter types, return types and exception specifications) may be private types or objects which would normally not be accessible and the template may be a member template or member function which would not normally be...