zeromq / cppzmq

Header-only C++ binding for libzmq
http://www.zeromq.org
MIT License
1.97k stars 757 forks source link

Generalize arithmetic operators for socket_base and derived #470

Closed albestro closed 3 years ago

albestro commented 3 years ago

Close #469

As mentioned in the issue and the referred comment, this PR is in particular needed for the migration to Catch2, which exposed that these operators were not covering some cases (e.g. socket_ref vs socket_t).

This generalization is based on polymorphism and improves const correctness, without exploiting custom cast operators of socket_ref and socket_t (indeed, it is not so clear to me the situation of these conversion functions, and their const correctness).

@gummif has for sure insight on this and may want to give a final feedback on this.