From 6d71b9b5414d502582bb0f53827524d1b8243be7 Mon Sep 17 00:00:00 2001 From: Gudmundur Adalsteinsson Date: Sat, 16 May 2020 12:39:54 +0000 Subject: [PATCH] Replace checks for C++17 with string view macro --- tests/socket.cpp | 2 +- zmq.hpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/socket.cpp b/tests/socket.cpp index d56a7bf..2e6d000 100644 --- a/tests/socket.cpp +++ b/tests/socket.cpp @@ -69,7 +69,7 @@ TEST_CASE("socket options", "[socket]") socket.set(zmq::sockopt::routing_id, "foobar"); socket.set(zmq::sockopt::routing_id, zmq::buffer(id)); socket.set(zmq::sockopt::routing_id, id); -#ifdef ZMQ_CPP17 +#if defined(ZMQ_HAS_STRING_VIEW) && (ZMQ_HAS_STRING_VIEW > 0) socket.set(zmq::sockopt::routing_id, std::string_view{id}); #endif diff --git a/zmq.hpp b/zmq.hpp index 260d5aa..6a3578f 100644 --- a/zmq.hpp +++ b/zmq.hpp @@ -582,7 +582,7 @@ class message_t { return std::string(static_cast(data()), size()); } -#ifdef ZMQ_CPP17 +#if defined(ZMQ_HAS_STRING_VIEW) && (ZMQ_HAS_STRING_VIEW > 0) // interpret message content as a string std::string_view to_string_view() const noexcept { @@ -1662,7 +1662,7 @@ class socket_base set_option(Opt, buf.data(), buf.size()); } -#ifdef ZMQ_CPP17 +#if defined(ZMQ_HAS_STRING_VIEW) && (ZMQ_HAS_STRING_VIEW > 0) // Set array socket option, e.g. // `socket.set(zmq::sockopt::routing_id, id_str)` template