mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-10-21 07:45:02 +02:00
Compare commits
22 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
b76c8aeb83 | ||
![]() |
b5599ef3fc | ||
![]() |
1a7aa5e5ec | ||
![]() |
aad5b96083 | ||
![]() |
dea3190d36 | ||
![]() |
c001a52582 | ||
![]() |
f58eb11fd5 | ||
![]() |
134beee0cd | ||
![]() |
434dae8424 | ||
![]() |
d8dd77884b | ||
![]() |
ea991d5a01 | ||
![]() |
6a127eb24f | ||
![]() |
5e57dc5da7 | ||
![]() |
d23a649427 | ||
![]() |
12ae60fd77 | ||
![]() |
282b0b5927 | ||
![]() |
0a261fca42 | ||
![]() |
20104301f3 | ||
![]() |
428780db53 | ||
![]() |
6bf5160bf2 | ||
![]() |
ef45359d81 | ||
![]() |
3202bb6a2e |
@@ -176,6 +176,7 @@ IF (MSGPACK_ENABLE_CXX)
|
||||
include/msgpack/adaptor/cpp11/array_char.hpp
|
||||
include/msgpack/adaptor/cpp11/array_unsigned_char.hpp
|
||||
include/msgpack/adaptor/cpp11/forward_list.hpp
|
||||
include/msgpack/adaptor/cpp11/reference_wrapper.hpp
|
||||
include/msgpack/adaptor/cpp11/shared_ptr.hpp
|
||||
include/msgpack/adaptor/cpp11/tuple.hpp
|
||||
include/msgpack/adaptor/cpp11/unique_ptr.hpp
|
||||
|
@@ -22,7 +22,7 @@
|
||||
#include "msgpack/adaptor/adaptor_base.hpp"
|
||||
#include "msgpack/adaptor/check_container_size.hpp"
|
||||
|
||||
// To supress warning on Boost.1.58.0
|
||||
// To suppress warning on Boost.1.58.0
|
||||
#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) || defined(__clang__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
||||
|
76
include/msgpack/adaptor/cpp11/reference_wrapper.hpp
Normal file
76
include/msgpack/adaptor/cpp11/reference_wrapper.hpp
Normal file
@@ -0,0 +1,76 @@
|
||||
//
|
||||
// MessagePack for C++ static resolution routine
|
||||
//
|
||||
// Copyright (C) 2015 KONDO Takatoshi
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#ifndef MSGPACK_CPP11_REFERENCE_WRAPPER_HPP
|
||||
#define MSGPACK_CPP11_REFERENCE_WRAPPER_HPP
|
||||
|
||||
#include "msgpack/versioning.hpp"
|
||||
#include "msgpack/adaptor/adaptor_base.hpp"
|
||||
#include "msgpack/adaptor/check_container_size.hpp"
|
||||
|
||||
#include <memory>
|
||||
#include <type_traits>
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
/// @cond
|
||||
MSGPACK_API_VERSION_NAMESPACE(v1) {
|
||||
/// @endcond
|
||||
|
||||
namespace adaptor {
|
||||
|
||||
template <typename T>
|
||||
struct convert<std::reference_wrapper<T>> {
|
||||
msgpack::object const& operator()(msgpack::object const& o, std::reference_wrapper<T>& v) const {
|
||||
msgpack::adaptor::convert<T>()(o, v.get());
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct pack<std::reference_wrapper<T>> {
|
||||
template <typename Stream>
|
||||
msgpack::packer<Stream>& operator()(msgpack::packer<Stream>& o, const std::reference_wrapper<T>& v) const {
|
||||
o.pack(v.get());
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct object<std::reference_wrapper<T> > {
|
||||
void operator()(msgpack::object& o, const std::reference_wrapper<T>& v) const {
|
||||
msgpack::adaptor::object<typename std::remove_const<T>::type>()(o, v.get());
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct object_with_zone<std::reference_wrapper<T>> {
|
||||
void operator()(msgpack::object::with_zone& o, const std::reference_wrapper<T>& v) const {
|
||||
msgpack::adaptor::object_with_zone<typename std::remove_const<T>::type>()(o, v.get());
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace adaptor
|
||||
|
||||
/// @cond
|
||||
} // MSGPACK_API_VERSION_NAMESPACE(v1)
|
||||
/// @endcond
|
||||
|
||||
} // namespace msgpack
|
||||
|
||||
#endif // MSGPACK_CPP11_REFERENCE_WRAPPER_HPP
|
@@ -99,7 +99,7 @@ template <>
|
||||
struct pack<msgpack::type::ext> {
|
||||
template <typename Stream>
|
||||
msgpack::packer<Stream>& operator()(msgpack::packer<Stream>& o, const msgpack::type::ext& v) const {
|
||||
// size limit has aleady been checked at ext's constructor
|
||||
// size limit has already been checked at ext's constructor
|
||||
uint32_t size = v.size();
|
||||
o.pack_ext(size, v.type());
|
||||
o.pack_ext_body(v.data(), size);
|
||||
@@ -110,7 +110,7 @@ struct pack<msgpack::type::ext> {
|
||||
template <>
|
||||
struct object_with_zone<msgpack::type::ext> {
|
||||
void operator()(msgpack::object::with_zone& o, const msgpack::type::ext& v) const {
|
||||
// size limit has aleady been checked at ext's constructor
|
||||
// size limit has already been checked at ext's constructor
|
||||
uint32_t size = v.size();
|
||||
o.type = msgpack::type::EXT;
|
||||
char* ptr = static_cast<char*>(o.zone.allocate_align(size + 1));
|
||||
@@ -131,7 +131,7 @@ public:
|
||||
// A default constructed ext_ref object::m_ptr doesn't have the buffer to point to.
|
||||
// In order to avoid nullptr checking branches, m_ptr points to m_size.
|
||||
// So type() returns unspecified but valid value. It might be a zero because m_size
|
||||
// is initialized as zero, but shoudn't assume that.
|
||||
// is initialized as zero, but shouldn't assume that.
|
||||
ext_ref() : m_ptr(static_cast<char*>(static_cast<void*>(&m_size))), m_size(0) {}
|
||||
ext_ref(const char* p, uint32_t s) :
|
||||
m_ptr(s == 0 ? static_cast<char*>(static_cast<void*>(&m_size)) : p),
|
||||
@@ -139,7 +139,7 @@ public:
|
||||
detail::check_container_size_for_ext<sizeof(std::size_t)>(s);
|
||||
}
|
||||
|
||||
// size limit has aleady been checked at ext's constructor
|
||||
// size limit has already been checked at ext's constructor
|
||||
ext_ref(ext const& x) : m_ptr(&x.m_data[0]), m_size(x.size()) {}
|
||||
|
||||
const char* data() const {
|
||||
@@ -184,7 +184,7 @@ private:
|
||||
};
|
||||
|
||||
inline ext::ext(ext_ref const& x) {
|
||||
// size limit has aleady been checked at ext_ref's constructor
|
||||
// size limit has already been checked at ext_ref's constructor
|
||||
m_data.reserve(x.size() + 1);
|
||||
|
||||
m_data.push_back(x.type());
|
||||
@@ -208,7 +208,7 @@ template <>
|
||||
struct pack<msgpack::type::ext_ref> {
|
||||
template <typename Stream>
|
||||
msgpack::packer<Stream>& operator()(msgpack::packer<Stream>& o, const msgpack::type::ext_ref& v) const {
|
||||
// size limit has aleady been checked at ext_ref's constructor
|
||||
// size limit has already been checked at ext_ref's constructor
|
||||
uint32_t size = v.size();
|
||||
o.pack_ext(size, v.type());
|
||||
o.pack_ext_body(v.data(), size);
|
||||
@@ -219,7 +219,7 @@ struct pack<msgpack::type::ext_ref> {
|
||||
template <>
|
||||
struct object<msgpack::type::ext_ref> {
|
||||
void operator()(msgpack::object& o, const msgpack::type::ext_ref& v) const {
|
||||
// size limit has aleady been checked at ext_ref's constructor
|
||||
// size limit has already been checked at ext_ref's constructor
|
||||
uint32_t size = v.size();
|
||||
o.type = msgpack::type::EXT;
|
||||
o.via.ext.ptr = v.m_ptr;
|
||||
|
@@ -74,7 +74,7 @@ struct object_with_zone<type::nil> {
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace adaptror
|
||||
} // namespace adaptor
|
||||
|
||||
template <>
|
||||
inline void msgpack::object::as<void>() const
|
||||
|
@@ -32,8 +32,7 @@
|
||||
|
||||
|
||||
|
||||
#if defined __cplusplus
|
||||
#if __cplusplus < 201103L
|
||||
#if defined(MSGPACK_USE_CPP03)
|
||||
|
||||
#if !defined(nullptr)
|
||||
# if _MSC_VER < 1600
|
||||
@@ -101,7 +100,7 @@ struct is_same<T, T> : true_type {};
|
||||
} // namespace msgpack
|
||||
|
||||
|
||||
#else // __cplusplus < 201103L
|
||||
#else // MSGPACK_USE_CPP03
|
||||
|
||||
#include <memory>
|
||||
#include <tuple>
|
||||
@@ -128,8 +127,6 @@ MSGPACK_API_VERSION_NAMESPACE(v1) {
|
||||
} // namespace msgpack
|
||||
|
||||
|
||||
#endif // __cplusplus < 201103L
|
||||
|
||||
#endif // __cplusplus
|
||||
#endif // MSGPACK_USE_CPP03
|
||||
|
||||
#endif /* msgpack/cpp_config.hpp */
|
||||
|
@@ -693,7 +693,7 @@ template <typename Stream>
|
||||
inline packer<Stream>& packer<Stream>::pack_str(uint32_t l)
|
||||
{
|
||||
if(l < 32) {
|
||||
unsigned char d = 0xa0u | static_cast<uint8_t>(l);
|
||||
unsigned char d = static_cast<uint8_t>(0xa0u | l);
|
||||
char buf = take8_8(d);
|
||||
append_buffer(&buf, 1);
|
||||
} else if(l < 256) {
|
||||
@@ -725,7 +725,7 @@ template <typename Stream>
|
||||
inline packer<Stream>& packer<Stream>::pack_v4raw(uint32_t l)
|
||||
{
|
||||
if(l < 32) {
|
||||
unsigned char d = 0xa0u | static_cast<uint8_t>(l);
|
||||
unsigned char d = static_cast<uint8_t>(0xa0u | l);
|
||||
char buf = take8_8(d);
|
||||
append_buffer(&buf, 1);
|
||||
} else if(l < 65536) {
|
||||
|
@@ -38,11 +38,13 @@
|
||||
# include <stdbool.h>
|
||||
#endif
|
||||
|
||||
#if !defined(MSGPACK_DLLEXPORT)
|
||||
#if defined(_MSC_VER)
|
||||
# define MSGPACK_DLLEXPORT __declspec(dllexport)
|
||||
#else /* _MSC_VER */
|
||||
# define MSGPACK_DLLEXPORT
|
||||
#endif /* _MSC_VER */
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
# define _msgpack_atomic_counter_header <windows.h>
|
||||
|
@@ -33,6 +33,7 @@
|
||||
#include "adaptor/cpp11/array_char.hpp"
|
||||
#include "adaptor/cpp11/array_unsigned_char.hpp"
|
||||
#include "adaptor/cpp11/forward_list.hpp"
|
||||
#include "adaptor/cpp11/reference_wrapper.hpp"
|
||||
#include "adaptor/cpp11/shared_ptr.hpp"
|
||||
#include "adaptor/cpp11/tuple.hpp"
|
||||
#include "adaptor/cpp11/unique_ptr.hpp"
|
||||
|
@@ -185,6 +185,7 @@ nobase_include_HEADERS += \
|
||||
../include/msgpack/adaptor/cpp11/array_char.hpp \
|
||||
../include/msgpack/adaptor/cpp11/array_unsigned_char.hpp \
|
||||
../include/msgpack/adaptor/cpp11/forward_list.hpp \
|
||||
../include/msgpack/adaptor/cpp11/reference_wrapper.hpp \
|
||||
../include/msgpack/adaptor/cpp11/shared_ptr.hpp \
|
||||
../include/msgpack/adaptor/cpp11/tuple.hpp \
|
||||
../include/msgpack/adaptor/cpp11/unique_ptr.hpp \
|
||||
|
@@ -48,9 +48,10 @@ IF (MSGPACK_CXX11)
|
||||
LIST (APPEND check_PROGRAMS
|
||||
iterator_cpp11.cpp
|
||||
msgpack_cpp11.cpp
|
||||
reference_cpp11.cpp
|
||||
reference_wrapper_cpp11.cpp
|
||||
shared_ptr_cpp11.cpp
|
||||
unique_ptr_cpp11.cpp
|
||||
reference_cpp11.cpp
|
||||
)
|
||||
ENDIF ()
|
||||
|
||||
|
@@ -39,6 +39,7 @@ check_PROGRAMS += \
|
||||
iterator_cpp11 \
|
||||
msgpack_cpp11 \
|
||||
reference_cpp11 \
|
||||
reference_wrapper_cpp11 \
|
||||
shared_ptr_cpp11 \
|
||||
unique_ptr_cpp11
|
||||
|
||||
@@ -76,6 +77,7 @@ zone_SOURCES = zone.cpp
|
||||
iterator_cpp11_SOURCES = iterator_cpp11.cpp
|
||||
msgpack_cpp11_SOURCES = msgpack_cpp11.cpp
|
||||
reference_cpp11_SOURCES = reference_cpp11.cpp
|
||||
reference_wrapper_cpp11_SOURCES = reference_wrapper_cpp11.cpp
|
||||
shared_ptr_cpp11_SOURCES = shared_ptr_cpp11.cpp
|
||||
unique_ptr_cpp11_SOURCES = unique_ptr_cpp11.cpp
|
||||
|
||||
|
@@ -553,3 +553,21 @@ TEST(limit, unpacker_array_over)
|
||||
EXPECT_TRUE(false);
|
||||
}
|
||||
}
|
||||
|
||||
TEST(limit, unpacker_reserve)
|
||||
{
|
||||
msgpack::unpacker u(nullptr, nullptr, MSGPACK_UNPACKER_INIT_BUFFER_SIZE,
|
||||
msgpack::unpack_limit());
|
||||
std::size_t original_capacity = u.buffer_capacity();
|
||||
u.reserve_buffer(original_capacity + 1u);
|
||||
EXPECT_EQ((original_capacity + COUNTER_SIZE) * 2 - COUNTER_SIZE, u.buffer_capacity());
|
||||
}
|
||||
|
||||
TEST(limit, unpacker_reserve_more_than_twice)
|
||||
{
|
||||
msgpack::unpacker u(nullptr, nullptr, MSGPACK_UNPACKER_INIT_BUFFER_SIZE,
|
||||
msgpack::unpack_limit());
|
||||
std::size_t original_capacity = u.buffer_capacity();
|
||||
u.reserve_buffer(original_capacity * 3);
|
||||
EXPECT_EQ((original_capacity + COUNTER_SIZE) * 4 - COUNTER_SIZE, u.buffer_capacity());
|
||||
}
|
||||
|
@@ -278,6 +278,16 @@ TEST(MSGPACK, simple_buffer_double)
|
||||
}
|
||||
}
|
||||
|
||||
TEST(MSGPACK, simple_buffer_nil)
|
||||
{
|
||||
msgpack::sbuffer sbuf;
|
||||
msgpack::packer<msgpack::sbuffer> packer(sbuf);
|
||||
packer.pack_nil();
|
||||
msgpack::unpacked ret;
|
||||
msgpack::unpack(ret, sbuf.data(), sbuf.size());
|
||||
EXPECT_EQ(ret.get().type, msgpack::type::NIL);
|
||||
}
|
||||
|
||||
TEST(MSGPACK, simple_buffer_true)
|
||||
{
|
||||
msgpack::sbuffer sbuf;
|
||||
|
@@ -372,3 +372,96 @@ TEST(unpack, insufficient_bytes_zone)
|
||||
EXPECT_EQ(off, 0u);
|
||||
}
|
||||
}
|
||||
|
||||
TEST(unpack, parse_error)
|
||||
{
|
||||
msgpack::sbuffer sbuf;
|
||||
|
||||
char c = '\xc1';
|
||||
sbuf.write(&c, 1);
|
||||
|
||||
bool thrown = false;
|
||||
msgpack::unpacked msg;
|
||||
try {
|
||||
msgpack::unpack(msg, sbuf.data(), sbuf.size());
|
||||
EXPECT_TRUE(false);
|
||||
}
|
||||
catch (msgpack::parse_error const&) {
|
||||
thrown = true;
|
||||
}
|
||||
EXPECT_TRUE(thrown);
|
||||
}
|
||||
|
||||
TEST(unpack, returned_parse_error)
|
||||
{
|
||||
msgpack::sbuffer sbuf;
|
||||
|
||||
char c = '\xc1';
|
||||
sbuf.write(&c, 1);
|
||||
|
||||
bool thrown = false;
|
||||
try {
|
||||
msgpack::unpack(sbuf.data(), sbuf.size());
|
||||
EXPECT_TRUE(false);
|
||||
}
|
||||
catch (msgpack::parse_error const&) {
|
||||
thrown = true;
|
||||
}
|
||||
EXPECT_TRUE(thrown);
|
||||
}
|
||||
|
||||
TEST(unpack, zone_parse_error)
|
||||
{
|
||||
msgpack::sbuffer sbuf;
|
||||
|
||||
char c = '\xc1';
|
||||
sbuf.write(&c, 1);
|
||||
|
||||
bool thrown = false;
|
||||
msgpack::zone z;
|
||||
try {
|
||||
msgpack::unpack(z, sbuf.data(), sbuf.size());
|
||||
EXPECT_TRUE(false);
|
||||
}
|
||||
catch (msgpack::parse_error const&) {
|
||||
thrown = true;
|
||||
}
|
||||
EXPECT_TRUE(thrown);
|
||||
}
|
||||
|
||||
TEST(unpack, extra_bytes)
|
||||
{
|
||||
msgpack::sbuffer sbuf;
|
||||
msgpack::pack(sbuf, 1);
|
||||
|
||||
msgpack::unpacked msg = msgpack::unpack(sbuf.data(), sbuf.size() + 1);
|
||||
EXPECT_EQ(1, msg.get().as<int>());
|
||||
}
|
||||
|
||||
TEST(unpack, zone_extra_bytes)
|
||||
{
|
||||
msgpack::sbuffer sbuf;
|
||||
msgpack::pack(sbuf, 1);
|
||||
|
||||
msgpack::zone z;
|
||||
msgpack::object obj = msgpack::unpack(z, sbuf.data(), sbuf.size() + 1);
|
||||
EXPECT_EQ(1, obj.as<int>());
|
||||
}
|
||||
|
||||
TEST(unpack, int_off_larger_than_length)
|
||||
{
|
||||
msgpack::sbuffer sbuf;
|
||||
msgpack::pack(sbuf, 1);
|
||||
|
||||
std::size_t off = 2;
|
||||
|
||||
bool thrown = false;
|
||||
try {
|
||||
msgpack::unpacked msg = msgpack::unpack(sbuf.data(), sbuf.size(), off);
|
||||
}
|
||||
catch (msgpack::insufficient_bytes const&) {
|
||||
thrown = true;
|
||||
}
|
||||
EXPECT_TRUE(thrown);
|
||||
EXPECT_EQ(off, 2u);
|
||||
}
|
||||
|
95
test/reference_wrapper_cpp11.cpp
Normal file
95
test/reference_wrapper_cpp11.cpp
Normal file
@@ -0,0 +1,95 @@
|
||||
#include <msgpack.hpp>
|
||||
#include <sstream>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#if !defined(MSGPACK_USE_CPP03)
|
||||
|
||||
TEST(MSGPACK_REFERENCE_WRAPPER, pack_convert)
|
||||
{
|
||||
int i1 = 42;
|
||||
std::reference_wrapper<int> val1(i1);
|
||||
std::stringstream ss;
|
||||
msgpack::pack(ss, val1);
|
||||
msgpack::object_handle oh = msgpack::unpack(ss.str().data(), ss.str().size());
|
||||
int i2 = 0;
|
||||
std::reference_wrapper<int> val2(i2);
|
||||
oh.get().convert(val2);
|
||||
EXPECT_EQ(i1, i2);
|
||||
}
|
||||
|
||||
TEST(MSGPACK_REFERENCE_WRAPPER, pack_convert_const)
|
||||
{
|
||||
const int i1 = 42;
|
||||
std::reference_wrapper<const int> val1(i1);
|
||||
std::stringstream ss;
|
||||
msgpack::pack(ss, val1);
|
||||
msgpack::object_handle oh = msgpack::unpack(ss.str().data(), ss.str().size());
|
||||
int i2 = 0;
|
||||
std::reference_wrapper<int> val2(i2);
|
||||
oh.get().convert(val2);
|
||||
EXPECT_EQ(i1, i2);
|
||||
}
|
||||
|
||||
TEST(MSGPACK_REFERENCE_WRAPPER, pack_vector)
|
||||
{
|
||||
int i1 = 42;
|
||||
std::vector<std::reference_wrapper<int>> val1{i1};
|
||||
std::stringstream ss;
|
||||
msgpack::pack(ss, val1);
|
||||
msgpack::object_handle oh = msgpack::unpack(ss.str().data(), ss.str().size());
|
||||
std::vector<int> val2 = oh.get().as<std::vector<int>>();
|
||||
EXPECT_EQ(val2.size(), 1);
|
||||
EXPECT_EQ(val1[0], val2[0]);
|
||||
}
|
||||
|
||||
TEST(MSGPACK_REFERENCE_WRAPPER, object)
|
||||
{
|
||||
int i1 = 42;
|
||||
std::reference_wrapper<int> val1(i1);
|
||||
msgpack::object o(val1);
|
||||
int i2 = 0;
|
||||
std::reference_wrapper<int> val2(i2);
|
||||
o.convert(val2);
|
||||
EXPECT_EQ(i1, i2);
|
||||
}
|
||||
|
||||
TEST(MSGPACK_REFERENCE_WRAPPER, object_const)
|
||||
{
|
||||
const int i1 = 42;
|
||||
std::reference_wrapper<const int> val1(i1);
|
||||
msgpack::object o(val1);
|
||||
int i2 = 0;
|
||||
std::reference_wrapper<int> val2(i2);
|
||||
o.convert(val2);
|
||||
EXPECT_EQ(i1, i2);
|
||||
}
|
||||
|
||||
TEST(MSGPACK_REFERENCE_WRAPPER, object_with_zone)
|
||||
{
|
||||
std::string s1 = "ABC";
|
||||
std::reference_wrapper<std::string> val1(s1);
|
||||
msgpack::zone z;
|
||||
msgpack::object o(val1, z);
|
||||
std::string s2 = "DE";
|
||||
std::reference_wrapper<std::string> val2(s2);
|
||||
o.convert(val2);
|
||||
EXPECT_EQ(s1, s2);
|
||||
}
|
||||
|
||||
TEST(MSGPACK_REFERENCE_WRAPPER, object_with_zone_const)
|
||||
{
|
||||
const std::string s1 = "ABC";
|
||||
std::reference_wrapper<const std::string> val1(s1);
|
||||
msgpack::zone z;
|
||||
msgpack::object o(val1, z);
|
||||
std::string s2 = "DE";
|
||||
std::reference_wrapper<std::string> val2(s2);
|
||||
o.convert(val2);
|
||||
EXPECT_EQ(s1, s2);
|
||||
}
|
||||
|
||||
#endif // !defined(MSGPACK_USE_CPP03)
|
Reference in New Issue
Block a user