opis.cc (629B)
1 #include "socket" 2 3 Socket const &Socket::operator=(Socket const &other) { 4 if (this != &other) { 5 6 #ifdef SOCKET_DEBUG 7 if (*_refcount == 1) { 8 debugmsg("Socket: destroying for assignment " << description() 9 << '\n'); 10 } else { 11 debugmsg("Socket: subtracting for assignment " << description() 12 << '\n'); 13 } 14 #endif 15 16 (*_refcount)--; 17 if (! *_refcount) { 18 delete _refcount; 19 delete _basesocket; 20 } 21 22 _refcount = other._refcount; 23 (*_refcount)++; 24 _basesocket = other._basesocket; 25 26 #ifdef SOCKET_DEBUG 27 debugmsg("Socket: assigned " << description() << '\n'); 28 #endif 29 } 30 31 return *this; 32 }