-
Notifications
You must be signed in to change notification settings - Fork 156
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
Conversation
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; |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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.
@zauguin Looks great to me ;-) |
The motivating use case for this are custom functions. With
variant
s you can create functions with flexible argument/return types.