-
Notifications
You must be signed in to change notification settings - Fork 227
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
Move constructor for pqxx::connection #113
Comments
I looked into this a few years ago, but there were some complications. Not necessarily blockers, but adding move constructors may require some changes across the inheritance hierarchy. In particular, a concrete connection type contains a policy object, and derives from Which is not to say that the idea is doomed. It just needs careful thought and discussion, and it's good to have this issue as an impulse for that. |
Is there any specific reason |
The policy reference is in the base class. Storing the policy object is more of a problem. We'd have to have a single class template, with the connection policy as a template parameter. That would be nice and simple, but different instantiations of the template would no longer be related! Every mention of a connection class anywhere in client code would have to specify the exact type of connection, or be templated on the connection type. |
If you store a |
True. Hate to do an avoidable heap allocation, but otherwise I think that would work. |
I made this a candidate for a prospective new major release. |
Thanks Jeroen! Currently I've been working around the issue by allocating into an std::array instead, the only downside is the size will be fixed. But that's OK for a basic connection pool :) |
Glad to hear that you're not stuck for now. But yes, maybe it's time to be a bit more wasteful with resources and a bit more considerate towards the programmer. |
Finally added a move constructor for |
Are there plans to add move constructors for the connection classes? This would allow the connections to be stored in a vector, for example.
Thanks for the great work!
The text was updated successfully, but these errors were encountered: