Derive other function name from __FUNCTION__? And call the function.

A

a_agaga

I would have one more question related to a problem, about which I have
discussed earlier:

http://groups.google.fi/group/comp....07f69/3907f29eaecd75c3?hl=fi#3907f29eaecd75c3

I would need to call a private method from a public method this way:

class wrapper_c
{
public:

int method1()
{
return intermediateMethod<int>(&wrapper_c::finalMethod1);

}


But I would not want to write to each methodX the names of the
finalMethodX
(the names of the finalMethodXs, which the methodXs should call).

Is there any mechanism (just) to derive the name of the finalMethodX
from methodX?
(And then call the finalMethdoX from methodX.)
Is it possible?

I would like to do something like this:
int method1()
{
return
intermediateMethod<int>(&wrapper_c::nameDerivedFrom__FUNCTION__);

}

int method2()
{
return
intermediateMethod<int>(&wrapper_c::nameDerivedFrom__FUNCTION__);

}

( I would not like to write a different finalMethodX name to different
methods...)


I mentioned the __FUNCTION__, just to try to make my question more
understandable.
I am interested about any kinds of solutions. It does not need to use
the __FUNCTION__ (macro).

I do not wish to make any separate lists / manual mappings between the
methodX and derivedMethodX methods.

Thank you!
 
A

a_agaga

If I could use a macro to implement the issue,
it would be ok too for this kind of a situation(!).
(Originally I was trying to avoid using a macro, but I think it could
be tolerable in this situation, if it is only applicaple.)

I could use a macro to implement this:

intermediateMethod<int>(&wrapper_c::nameDerivedFrom__FUNCTION__);

(I do not know yet is it possible.)
Tips are welcome!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top