> How do I get at some private field?
That one is interesting! I wonder how smart it is.
For instance in the following example:
class foo
{
public:
std::pair<int, int> get_coordinates() const { return std::make_pair(m_x, m_y); }
private:
int m_x;
int m_y;
};
void test(foo *ptr)
{
if (ptr->m_x >= 3)
;// etc
}
I wonder if the compiler would be able to figure out that m_x is accessible via `ptr->get_coordinates().first` ?