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

std::variant support #95

Merged
merged 5 commits into from
Feb 22, 2017
Merged

std::variant support #95

merged 5 commits into from
Feb 22, 2017

Conversation

zauguin
Copy link
Collaborator

@zauguin zauguin commented Feb 21, 2017

The motivating use case for this are custom functions. With variants you can create functions with flexible argument/return types.

README.md Outdated
db << "CREATE TABLE tbl (id integer, data);";
db << "INSERT INTO tbl VALUES (?, ?, ?);" << 1 << vector<int> { 1, 2, 3};
unique_ptr<string> ptr_null; // you can even bind empty unique_ptr<T>
db << "INSERT INTO tbl VALUES (?, ?, ?);" << 2 << 2.5;
Copy link
Collaborator

Choose a reason for hiding this comment

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

@zauguin Here It should be two question marks, right? INSERT INTO tbl values (?, ?)

README.md Outdated
};

db << "select age,name,img from tbl where id = 2"
>> [](std::variant<vector<int>, double> data) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

@zauguin age, name, img are not defined in the table and the lambda is only taking one argument.

@aminroosta
Copy link
Collaborator

@zauguin Looks great to me ;-)

@zauguin zauguin merged commit 6b468a4 into SqliteModernCpp:master Feb 22, 2017
@zauguin zauguin deleted the variant branch May 13, 2017 18:23
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