Clarify example requirements

This commit is contained in:
Gudmundur Adalsteinsson 2019-08-15 22:02:20 +00:00
parent b2fa1192bd
commit 4b443fc59b
2 changed files with 7 additions and 7 deletions

View File

@ -41,16 +41,17 @@ Supported platforms
Examples
========
This example requires at least C++11.
```c++
#include <string>
#include <zmq.hpp>
int main()
{
zmq::context_t ctx;
zmq::socket_t sock(ctx, zmq::socket_type::push);
sock.bind("inproc://test");
const std::string_view m = "Hello, world";
sock.send(zmq::buffer(m), zmq::send_flags::dontwait);
zmq::context_t ctx;
zmq::socket_t sock(ctx, zmq::socket_type::push);
sock.bind("inproc://test");
sock.send(zmq::str_buffer("Hello, world"), zmq::send_flags::dontwait);
}
```

View File

@ -71,8 +71,7 @@ TEST_CASE("socket readme example", "[socket]")
zmq::context_t ctx;
zmq::socket_t sock(ctx, zmq::socket_type::push);
sock.bind("inproc://test");
const std::string m = "Hello, world";
sock.send(zmq::buffer(m), zmq::send_flags::dontwait);
sock.send(zmq::str_buffer("Hello, world"), zmq::send_flags::dontwait);
}
#endif