- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
const Tifon& Tifon::operator=(const Tifon& Buffer)
{
assert(&Buffer!=this);
if(&Buffer==this)
return *this;
Tifon OldForExceptionSafe(*this);
try{
this->~Tifon();
::new((void*)this)Tifon(Buffer);
}catch(...){//try restore
::new((void*)this)Tifon(OldForExceptionSafe);
}
return *this;
};
//...
namespace std
{
const Tifon&swap (Tifon& a, Tifon& b) {
assert(&a!=&b);
if(&a==&b)
return a;
Tifon c(a);
a=b;
b=c;
}
};