dimanche 31 juillet 2016

tuple of void member functions

I'm attempting to create a tuple which contains a pointer to a void member function, but I'm having trouble making it work. here's my code:

class A
{
    void dostuff(){ cout<<" doing stuff "}
};

class B
{
    A* aobj;
    typedef vector<vector<tuple<int,int,void(A::*)()>>> sequence;

    sequence Sequence;

    void getinfo(int n1, int n2, void(A::*func)())
    {
        Sequence.resize(1);
        Sequence[0].push_back(make_tuple(n1,n2,(aobj->*func)()))//<--ERROR HERE
    };
};

it's giving me the error "invalid use of void expression." I also tried to simplify the function to :

void getinfo(void(A::*func)())
{
    make_tuple((aobj->*func)());
}

and it still gives me the same error.

Aucun commentaire:

Enregistrer un commentaire