Problem: extended initializer lists only available in C++11

This commit is contained in:
Pawel Kurdybacha 2018-04-14 14:06:32 +01:00
parent 6caa5d19d3
commit f518a648ef

View File

@ -8,23 +8,23 @@ TEST (message, create_destroy)
TEST (message, constructors) TEST (message, constructors)
{ {
const std::string hi {"Hi"}; const std::string hi ("Hi");
zmq::message_t hi_msg_a {hi.begin (), hi.end ()}; zmq::message_t hi_msg_a (hi.begin (), hi.end ());
ASSERT_EQ (hi_msg_a.size (), hi.size ()); ASSERT_EQ (hi_msg_a.size (), hi.size ());
zmq::message_t hi_msg_b {hi.data (), hi.size ()}; zmq::message_t hi_msg_b (hi.data (), hi.size ());
ASSERT_EQ (hi_msg_b.size (), hi.size ()); ASSERT_EQ (hi_msg_b.size (), hi.size ());
ASSERT_EQ (hi_msg_a, hi_msg_b); ASSERT_EQ (hi_msg_a, hi_msg_b);
#if defined(ZMQ_BUILD_DRAFT_API) && defined(ZMQ_CPP11) #if defined(ZMQ_BUILD_DRAFT_API) && defined(ZMQ_CPP11)
zmq::message_t hello_msg_a {"Hello"}; zmq::message_t hello_msg_a ("Hello");
ASSERT_NE (hi_msg_a, hello_msg_a); ASSERT_NE (hi_msg_a, hello_msg_a);
ASSERT_NE (hi_msg_b, hello_msg_a); ASSERT_NE (hi_msg_b, hello_msg_a);
zmq::message_t hi_msg_c {hi}; zmq::message_t hi_msg_c (hi);
ASSERT_EQ (hi_msg_c, hi_msg_a); ASSERT_EQ (hi_msg_c, hi_msg_a);
ASSERT_EQ (hi_msg_c, hi_msg_b); ASSERT_EQ (hi_msg_c, hi_msg_b);
ASSERT_NE (hi_msg_c, hello_msg_a); ASSERT_NE (hi_msg_c, hello_msg_a);
#endif #endif
#ifdef ZMQ_HAS_RVALUE_REFS #ifdef ZMQ_HAS_RVALUE_REFS
zmq::message_t hello_msg_b{zmq::message_t{"Hello"}}; zmq::message_t hello_msg_b(zmq::message_t("Hello"));
ASSERT_EQ (hello_msg_a, hello_msg_b); ASSERT_EQ (hello_msg_a, hello_msg_b);
#endif #endif
} }