Skip to content

Return values instead of assigning to references #154

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

Merged
merged 3 commits into from
Feb 15, 2018

Conversation

zauguin
Copy link
Collaborator

@zauguin zauguin commented Feb 14, 2018

Return extracted values in the type wrapper instead of assigning to references.
This makes the type specific functions easier and avoids unnecessary temporaries in some situations.
Compare https://github.com/SqliteModernCpp/sqlite_modern_cpp/pull/126/files#r163217134

@zauguin zauguin requested a review from aminroosta February 14, 2018 11:11
Copy link
Collaborator

@aminroosta aminroosta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we are overloading get_col(/val)_from_db on result_type<T> (which is gonna be optimized away). And with RVO we might even gain a slightly better performance than using references (since we are not assinging to std::string or std::vector<T> anymore).

@zauguin Looks good to me 👍

@zauguin zauguin merged commit b6a1321 into SqliteModernCpp:dev Feb 15, 2018
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

Successfully merging this pull request may close these issues.

2 participants