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

View File

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