Solution: Add `zmq::sockopt::socket_type` that is used to `get()` an enumerator
from `zmq::socket_type` instead of plain `int`.
It makes code like this compile:
#include <zmq.hpp>
#include <cassert>
int main()
{
zmq::context_t ctx;
zmq::socket_t sock(ctx, zmq::socket_type::push);
assert(sock.get(zmq::sockopt::socket_type) == zmq::socket_type::push);
return 0;
}
If you use a compiler outside of _MSC_VER and _GNUC__, then the if-else check doesn't provide a fallback for ZMQ_DEPRECATED macro which leads to a build failure.
Specifically in my case , I am using Oracle's SunPro 5.13.0.
My suggestions is to fallback to noop in case you don't recognize a compiler.
Solution: Constuctor taking generic ranges including
string literals includes the null terminated char in
the message. Deprecate function and add overloads
for strings.
Until now, we only assigned the _handle on
`zmq::socket_t::operator=(socket_t&&)`. This manifests when trying to
monitor a socket initialized by that constructor.
To avoid changing the public interface of the socket_t class, we tested
for the specific monitor usecase, since it's the only class accessing
zmq::socke_t::ctxptr.
NOTE: When running the new unit-test without the fix, it might hang on
`zmq_socket_monitor(socket_, NULL, 0)`. We haven't figured out the cause
for that, but we deemed it unimportant (or at least out of scope).
This commit fixes a regression introduced in a3e5b54c3 (Problem: Socket
options lack type-safety (#393)).
It addresses the following error reported when building the project
on macOS 10.11.6.
Errors like the following:
cppzmq/zmq.hpp:1325:39: error: default initialization of an object of const type 'const affinity_t' (aka 'const integral_option<4, unsigned long long, false>') without a user-provided default constructor
Compiler version:
Apple LLVM version 8.0.0 (clang-800.0.42.1)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Similar issues:
* https://github.com/tensorflow/tensorflow/issues/28839
error: default initialization of an object of const type 'const Subgraph::Identity' without a user-provided default constructor
* https://bugzilla.mozilla.org/show_bug.cgi?id=1451088
Clang 3.8: error: default initialization of an object of const type 'const js::jit::ArithPolicy' without a user-provided default constructor
* https://github.com/googleapis/google-cloud-cpp/issues/1593
[osx] error: default initialization of an object of const type
Co-authored-by: Gudmundur Adalsteinsson <ofpgummi@yahoo.com>