vendredi 20 avril 2018

c++ mutex member of class causing compilation Error

I'm not sure why this is happening when I add a mutex member to myClass(in this example mu):

Error   C2661   "'std::tuple<
void (__thiscall MyNameSpace::myClass::* )(void),MyNameSpace::myClass>::tuple': no overloaded function takes 2 arguments include\memory 2438

namespace MyNameSpace{
class myClass{
    shared_ptr<myClass2> property;
    mutex mu;

public:
    myClass(shared_ptr<myClass2> arg):property(std::move(arg)) {

    }
}
class myClass2{
public:
    myClass2(std::string str) {
        trace(str);
    }
}
       }
int main(){
shared_ptr<myClass2> new_obj(new myClass2("somthing"));
    thread(&myClass::Run, myClass(new_obj)).join();
.......other stuff.....
}

Aucun commentaire:

Enregistrer un commentaire