Dear Kjell, At first Thank you for your reply, You woke up me,I was asleep and code, thank you, i need to rest... --mohsen On Wed, 2012-08-01 at 18:53 +0200, Kjell Ahlstedt wrote: > 2012-08-01 16:45, Mohsen Pahlevanzadeh skrev: > > Dear all, > > > > I have 2 question: a. about the libsigc b. about (this) word and typeof > > or decltype > > I have NetworkSocket class and coded in main() func such as the > > following: > > /////////////////////////////////// > > NetworkSocket *oo = new NetworkSocket(); > > oo->ready.connect(sigc::ptr_fun(&NetworkSocket::createThread)); > > oo->run(); > > /////////////////////////////////////// > > Above code get the following error: > > ///////////////// > > error: no matching function for call to ‘ptr_fun(bool (NetworkSocket::*)())’ > > //////////////// > > > > When i comment the above code , and put the following code in constructor : > > ////////////////////////////////////// > > typeof(this) sig = new NetworkSocket(); > > sig->ready.connect(sigc::ptr_fun(createThread)); > > this->run(); > > //////////////////////////////////////// > > I get the following error: > > //////////////////////////////// > > error: no matching function for call to ‘ptr_fun(<unresolved overloaded function type>)’ > > //////////////////////////////// > > So , i think g++ can't understand type of this reserverd word.And i don't understand no match call function. > > > > Yours, > > Mohsen > > > Is NetworkSocket::createThread() a static member function? If it's not > static, you must use sigc::mem_fun() instead of sigc::ptr_fun(). > > NetworkSocket *oo = new NetworkSocket(); > oo->ready.connect(sigc::mem_fun(*oo, &NetworkSocket::createThread)); > oo->run(); > > or > > typeof(this) sig = new NetworkSocket(); > sig->ready.connect(sigc::mem_fun(*this, &NetworkSocket::createThread)); > // or mem_fun(*sig...? > this->run(); > > but here you have 2 NetworkSocket objects, *this and *sig. Is that what > you want? Should it be > > ready.connect(sigc::mem_fun(*this, &NetworkSocket::createThread)); > this->run(); > > What makes you suspect that g++ does not understand typeof(this)? You > don't mention any error message that contains 'typeof'. >
Attachment:
signature.asc
Description: This is a digitally signed message part