What is wrong with “checking for self-assignment” and what does it mean?

A question that’s of greater importance in this case would be: “What does it mean, when a you write function in a way, that requires you to check for self assignment???” To answer my rhetorical question: It means that a well-designed assignment operator should not need to check for self-assignment. Assigning an object to itself … Read more

The simplest and neatest c++11 ScopeGuard

Even shorter: I don’t know why you guys insist on putting the template on the guard class. #include <functional> class scope_guard { public: template<class Callable> scope_guard(Callable && undo_func) try : f(std::forward<Callable>(undo_func)) { } catch(…) { undo_func(); throw; } scope_guard(scope_guard && other) : f(std::move(other.f)) { other.f = nullptr; } ~scope_guard() { if(f) f(); // must not … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)