Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad custom constructor behavior in #63 fix #66

Closed
polesapart opened this issue Jan 10, 2017 · 1 comment
Closed

Bad custom constructor behavior in #63 fix #66

polesapart opened this issue Jan 10, 2017 · 1 comment

Comments

@polesapart
Copy link

The fix for #63 as in pull-request #64 have problems.

The custom constructor takes some members from the target object but nullifies them afterwards:

database_binder(database_binder&& other) :
		_db(std::move(other._db)),
		_sql(std::move(other._sql)),
		_stmt(std::move(other._stmt)),
		_inx(other._inx), execution_started(other.execution_started) {
			_db = nullptr;
			_stmt = nullptr;
	}

In the initialization list it takes (moves) the db & stmt, but discards them on the body. The fix is to leave the body empty (I think the idea was to do other.{_db,_stmt} = nullptr instead, but that's not need as the move constructor from std::shared_ptr() will take care of that).

@polesapart polesapart changed the title Bad custom std::move behavior Bad custom constructor behavior in #63 fix Jan 10, 2017
@aminroosta
Copy link
Collaborator

@polesapart You are absolutely right, my foolish mistake.
aminroosta@13b5c9e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants