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

Discussion in 'C++' started by a_agaga@yahoo.com, Nov 16, 2006.

  1. Guest

    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!
    , Nov 16, 2006
    #1
    1. Advertising

  2. Guest

    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!
    , Nov 16, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mockey Chen

    __FUNCTION__ in another macro

    Mockey Chen, Jul 27, 2006, in forum: C Programming
    Replies:
    19
    Views:
    736
    Keith Thompson
    Jul 29, 2006
  2. Neo
    Replies:
    9
    Views:
    22,203
  3. somenath
    Replies:
    1
    Views:
    655
    Richard Bos
    Aug 2, 2007
  4. Ravi

    __FUNCTION__

    Ravi, Sep 27, 2007, in forum: C Programming
    Replies:
    7
    Views:
    616
    Richard Bos
    Sep 28, 2007
  5. Tom Anderson
    Replies:
    0
    Views:
    425
    Tom Anderson
    Apr 22, 2011
Loading...

Share This Page