#include <iostream>
class Screen
{
public:
void some_member () const;
size_t get() const { return access_ctr; }
private:
mutable size_t access_ctr = 0;
};
void Screen::some_member () const
{
++access_ctr;
}
int main()
{
const Screen s;
for (int i = 0; i < 5; ++i)
{
s.some_member();
std::cout << s.get() << std::endl;
}
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKY2xhc3MgU2NyZWVuCnsKcHVibGljOgogICAgICAgIHZvaWQgc29tZV9tZW1iZXIgKCkgY29uc3Q7CiAgICAgICAgc2l6ZV90IGdldCgpIGNvbnN0IHsgcmV0dXJuIGFjY2Vzc19jdHI7IH0KcHJpdmF0ZToKICAgICAgICBtdXRhYmxlIHNpemVfdCBhY2Nlc3NfY3RyID0gMDsKfTsKCnZvaWQgU2NyZWVuOjpzb21lX21lbWJlciAoKSBjb25zdAp7CiAgICAgICAgKythY2Nlc3NfY3RyOwp9CgppbnQgbWFpbigpCnsKICAgICAgICBjb25zdCBTY3JlZW4gczsKICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IDU7ICsraSkKICAgICAgICB7CiAgICAgICAgICAgICAgICBzLnNvbWVfbWVtYmVyKCk7CiAgICAgICAgICAgICAgICBzdGQ6OmNvdXQgPDwgcy5nZXQoKSA8PCBzdGQ6OmVuZGw7CiAgICAgICAgfQp9Cgo=