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

Added blob_t alternative #159

Closed
wants to merge 1 commit into from
Closed

Conversation

roussosalex
Copy link

A simple alternative to the std::vector approach. Makes it easier to supply a pointer and size for arbitrary binary blobs.

@aminroosta
Copy link
Collaborator

@roussosalex Thank you for the PR, lack of operator >> for raw pointers is a valid point.
In fact we had a discussion in #122 on the interface of next version (v4).

My proposal is to change the meaning of operator >> for vector<T>.

// single row blob
vector<int> vblob;
db << "select numbers from tbl where id = 1" >> blob_t(vblob);
// multiple row int
vector<int> vrows;
db << "select age from tbl;" >> vrows;

The std::vector is an example here, this could/should work for all standard containers.
blob_t can be partially specialized for different types (blob_t<vector<T>>, blob_t<T*,size_t> or blob_t<span<T>>).
Heres is POC for blob_t #125

@roussosalex
Copy link
Author

@aminroosta Thanks for the quick response.
Your proposal seems reasonable, especially because specializing blob_t is a much cleaner solution than overloading the operator>> for custom types.

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