Hello, I would like to submit a patch to add C++11 move constructors and assignment operators to zmq::socket_t and zmq::context_t.
These types are not copy-constructible and copy-assignable, for good reason. However, in C++11, they can be made move-constructible and move-assignable. I have attached a patch that adds a move constructor and move assignment operator to them. These functions are only enabled when the compiler supports C++11 rvalue references, which are needed to implement move constructors and move assignment operators. Therefore, the code continues to be fully compatible with compilers that do not support this C++11 feature. I have added code at the top of the file that detects whether the compiler supports rvalue references, for three popular compilers: gcc, msvc, and clang. Code that detects support in other compilers can easily be added if desired. For now, the code assumes that the compiler does not have rvalue reference support if it's not one of these three compilers. The patch is against the 2.1 branch. Can this patch be added to the next release? Best regards, Botond
0001-C-11-move-constructor-assignment-operator-for-socket.patch
Description: Binary data
_______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
