V
viki
We have zillion of instances inf instance->m_member in the code.
We are going introduce the 'accessors' Get() and Set() for m_member,
and
m_member going private (and renamed, too). We would like to leave, if
possible,
refs inst->m_member in the code, but make compiler translate
it to inst->Get() invisily, and without using macros. Let's assume T
is
a type of m_member.
Is there any c++ trick to redirect inst->m_foo /* no parentheses
after m_foo */
to function call inst->Get(), without using macros ? I am sure there
is some
trick of declaring m_foo a special small class that evaluates a
function
when accessed, but I can't figure it out.
Apparently semi-possible with #define (only outside of the class):
#define m_member Get()
but that sucks
(you do not need to enumerate all reasons why it sucks, we are not
going to use it; this just to illustrates equivalent of what we
want).
We do not want to use macro, we want the C++ equivalent.
V.M.
We are going introduce the 'accessors' Get() and Set() for m_member,
and
m_member going private (and renamed, too). We would like to leave, if
possible,
refs inst->m_member in the code, but make compiler translate
it to inst->Get() invisily, and without using macros. Let's assume T
is
a type of m_member.
Is there any c++ trick to redirect inst->m_foo /* no parentheses
after m_foo */
to function call inst->Get(), without using macros ? I am sure there
is some
trick of declaring m_foo a special small class that evaluates a
function
when accessed, but I can't figure it out.
Apparently semi-possible with #define (only outside of the class):
#define m_member Get()
but that sucks
(you do not need to enumerate all reasons why it sucks, we are not
going to use it; this just to illustrates equivalent of what we
want).
We do not want to use macro, we want the C++ equivalent.
V.M.