Compare commits

..

40 Commits

Author SHA1 Message Date
Takatoshi Kondo
919908742b Fixed brace 2024-11-02 11:41:41 +09:00
Takatoshi Kondo
3c8ca3b29b Merge pull request #1145 from redboltz/update_to_700
Updated the version to 7.0.0.
2024-11-02 11:31:49 +09:00
Takatoshi Kondo
b41688c588 Updated the version to 7.0.0. 2024-11-02 11:10:53 +09:00
Takatoshi Kondo
405977dfa6 Merge pull request #1144 from stephanlachnit/p-cpp-revert-broken-float
Revert "Merge pull request #1018 from GeorgFritze/cpp_master"
2024-10-31 21:18:23 +09:00
Stephan Lachnit
3788b5ba63 Revert "Merge pull request #1018 from GeorgFritze/cpp_master"
This reverts commit d13d933eea, reversing
changes made to 05f654fd64.
2024-10-24 16:35:11 +02:00
Takatoshi Kondo
5c606bd638 Merge pull request #1133 from redboltz/fix_1132
Fixed cmake warnings.
2024-08-06 12:44:10 +09:00
Takatoshi Kondo
0605190fd3 Removed C++03 builds from appveyor. 2024-08-06 12:22:17 +09:00
Takatoshi Kondo
28cfb1ff81 Boost.Test has dropped C++03 support.
msgpack-c adjusted it.
2024-08-06 11:38:49 +09:00
Takatoshi Kondo
636a0130ba Conditional include msgpack::variant.
It uses boost::variant. boost::variant requires boost::tyoe_index.
boost::type index has dropped C++03 support.
2024-08-06 11:21:55 +09:00
Takatoshi Kondo
22f6fa1cd2 Fixed brew update on CI. 2024-08-06 10:50:12 +09:00
Takatoshi Kondo
232fff18d4 Fixed cmake warnings. 2024-08-06 10:26:03 +09:00
Takatoshi Kondo
820ccf1f1d Merge pull request #1122 from redboltz/fix_ci
Updated the boost version to 1.85.0
2024-05-28 07:22:01 +09:00
Takatoshi Kondo
a687df0e22 Update osx enviconment. 2024-05-27 23:58:29 +09:00
Takatoshi Kondo
8d57954246 Updated the boost version to 1.85.0 2024-05-27 23:36:29 +09:00
Takatoshi Kondo
5c521bc346 Merge pull request #1117 from redboltz/fix_1116
Fixed invalid documentation.
2024-04-17 20:47:25 +09:00
Takatoshi Kondo
7bb73f3b98 Fixed invalid documentation. 2024-04-17 20:19:00 +09:00
Takatoshi Kondo
44c0f705c9 Merge pull request #1113 from redboltz/update_to_611
Update the version to 6.1.1.
2024-04-02 12:13:33 +09:00
Takatoshi Kondo
ddb884e9cd Update the version to 6.1.1. 2024-04-02 11:14:58 +09:00
Takatoshi Kondo
c593c32b87 Merge pull request #1112 from uyha/same-type-variant
Fix compilation error when `std::variant` has the same types
2024-04-02 11:07:50 +09:00
Uy Ha
d812fa5edc Fix compilation error when std::variant has the same types 2024-04-02 01:23:25 +00:00
Takatoshi Kondo
e9e06a546c Merge pull request #1110 from Zopolis4/appveyedcpp
Fix appveyor for cpp_master
2024-03-07 15:54:10 +09:00
Zopolis4
1021aeea6f Update zlib to 1.3.1 in appveyor.yml and .github/depends/zlib.sh 2024-03-07 16:58:37 +11:00
Takatoshi Kondo
2c0040cef6 Merge pull request #1101 from msgpack/revert-1096-Arenoros-zone/optimization_size/delayed_malloc
Revert "Arenoros zone/optimization size/delayed malloc"
2023-11-23 19:22:14 +09:00
Takatoshi Kondo
f33c7dfdbe Removd boost system. 2023-11-23 18:38:43 +09:00
Takatoshi Kondo
d372a71786 Revert "Arenoros zone/optimization size/delayed malloc" 2023-11-23 18:24:47 +09:00
Takatoshi Kondo
2987022c10 Merge pull request #1096 from redboltz/Arenoros-zone/optimization_size/delayed_malloc
Arenoros zone/optimization size/delayed malloc
2023-10-03 12:47:02 +09:00
Takatoshi Kondo
34f531e26e Rename ruby file. 2023-10-03 10:51:29 +09:00
Takatoshi Kondo
91006555f1 Remove boost system requirement. 2023-10-03 10:51:29 +09:00
Takatoshi Kondo
cd7c5bcfec Remove Boost::system. 2023-10-03 10:51:29 +09:00
Arenoros
add68ff9e6 replace nullptr -> MSGPACK_NULLPTR 2023-10-02 19:52:40 +03:00
Arenoros
ede530de0a fix build 2023-10-02 19:52:40 +03:00
Arenoros
62de80fa72 port optimizations for cpp03 2023-10-02 19:52:40 +03:00
Arenoros
f2b3f52d44 Correction of comments 2023-10-02 19:52:40 +03:00
Arenoros
035bfeb39e fix zone::chunk_list::clear 2023-10-02 19:52:40 +03:00
Arenoros
04292fe63d fix failed test 2023-10-02 19:52:40 +03:00
Arenoros
573ebca3d2 Optimization of msgpack::zone size on the stack and deferred memory allocation 2023-10-02 19:52:40 +03:00
Takatoshi Kondo
37fcaa1264 Merge pull request #1090 from redboltz/update_zlib_for_ci
Updated zlib for CI.
2023-08-30 00:00:16 +09:00
Takatoshi Kondo
a55c73d90e Updated zlib for CI. 2023-08-29 23:28:21 +09:00
Takatoshi Kondo
b2f056c8b6 Merge pull request #1085 from hiradyazdan/cpp_master
Fix to avoid common function name's (`has_as::check`) ambiguity/conflict with other libraries' macros
2023-08-14 09:26:04 +09:00
hiradyazdan
e7f7b51005 modified function name 'has_as::check' to avoid ambiguity/conflicts with other libraries/engines's macro definitions (e.g. UE) 2023-08-13 18:32:33 +01:00
22 changed files with 114 additions and 103 deletions

View File

@@ -49,9 +49,9 @@ while getopts "b:t:p:" c; do
done
mkdir $prefix || exit 1
wget https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.bz2 || exit 1
tar xf boost_1_76_0.tar.bz2 || exit 1
cd boost_1_76_0
wget https://boostorg.jfrog.io/artifactory/main/release/1.85.0/source/boost_1_85_0.tar.bz2 || exit 1
tar xf boost_1_85_0.tar.bz2 || exit 1
cd boost_1_85_0
./bootstrap.sh || exit 1
build()

View File

@@ -27,9 +27,9 @@ while getopts "b:t:p:" c; do
done
mkdir $prefix || exit 1
wget https://zlib.net/zlib-1.2.13.tar.gz || exit 1
tar -xf zlib-1.2.13.tar.gz || exit 1
cd zlib-1.2.13
wget https://zlib.net/zlib-1.3.1.tar.gz || exit 1
tar -xf zlib-1.3.1.tar.gz || exit 1
cd zlib-1.3.1
build()
{

View File

@@ -27,7 +27,7 @@ jobs:
uses: actions/cache@v1
with:
path: ~/boost-prefix/
key: ${{ runner.os }}-boost-64-1-76-0-2021-08-09
key: ${{ runner.os }}-boost-1-85-0-2024-05-27
- name: Build boost
if: steps.cache-boost.outputs.cache-hit != 'true'

View File

@@ -18,14 +18,19 @@ jobs:
matrix:
pattern: [0, 1, 2, 3, 4]
steps:
- uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v3
- name: Install Dependencies
run: |
brew update
brew install --force llvm
- name: Cache boost
id: cache-boost
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/boost-prefix/
key: ${{ runner.os }}-boost-1-76-0-2022-08-09
key: ${{ runner.os }}-boost-1-85-0-2024-05-27
- name: Build boost
if: steps.cache-boost.outputs.cache-hit != 'true'
@@ -33,7 +38,7 @@ jobs:
- name: Cache zlib
id: cache-zlib
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/zlib-prefix/
key: ${{ runner.os }}-zlib-1-2-13-2022-11-02
@@ -55,7 +60,7 @@ jobs:
case ${{ matrix.pattern }} in
0)
export MSGPACK_CXX_VERSION="MSGPACK_CXX11=OFF"
export MSGPACK_CXX_VERSION="MSGPACK_CXX11=ON"
;;
1)
export API_VERSION=1
@@ -85,7 +90,7 @@ jobs:
matrix:
pattern: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Install build dependencies
shell: bash
@@ -97,10 +102,10 @@ jobs:
- name: Cache boost
id: cache-boost
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/boost-prefix/
key: ${{ runner.os }}-boost-1-76-0-2021-08-09
key: ${{ runner.os }}-boost-1-85-0-2024-05-27
- name: Build boost
if: steps.cache-boost.outputs.cache-hit != 'true'
@@ -108,7 +113,7 @@ jobs:
- name: Cache zlib
id: cache-zlib
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/zlib-prefix/
key: ${{ runner.os }}-zlib-1-2-13-2022-11-02
@@ -132,7 +137,7 @@ jobs:
case ${{ matrix.pattern }} in
0)
export CXX="clang++-10"
export MSGPACK_CXX_VERSION="MSGPACK_CXX11=OFF"
export MSGPACK_CXX_VERSION="MSGPACK_CXX11=ON"
;;
1)
export CXX="g++-10"
@@ -198,11 +203,11 @@ jobs:
cxx: [14, 17, 20]
pp_flag: ["/Zc:preprocessor-", "/Zc:preprocessor"]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Cache vcpkg dependencies
id: cache-vcpkg
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: C:/vcpkg/installed/x64-windows
key: ${{ runner.os }}-vcpkg-2021-08-09

View File

@@ -1,3 +1,18 @@
# 2024-11-02 version 7.0.0
* Refine build system (#1133)
* Refine CI (#1122)
* Refine documents (#1117)
## << breaking changes >>
* Revert double and fload packing behavior (#1144)
* If below decimal point is zero (e.g. 2.00),
* Before: pack as int format family `0x02`
* After : pack as float format family `0xcb 0x40 0x00 0x00 0x00 0x00 0x00 0x00 0x00`
# 2024-04-02 version 6.1.1
* Fix compilation error when std::variant has the same types (#1112)
* Improve CI (#1090, #1110)
* Fix to avoid common function name's (has_as::check) ambiguity/conflict with other libraries' macros (#1085)
# 2023-07-08 version 6.1.0
* Remove dependency on boost in chrono.hpp (#1076)
* Add support for std::variant behavior (#1075)

View File

@@ -1,6 +1,12 @@
CMAKE_MINIMUM_REQUIRED (VERSION 3.1 FATAL_ERROR)
CMAKE_POLICY (SET CMP0054 NEW)
if(${CMAKE_VERSION} VERSION_GREATER "3.4")
CMAKE_MINIMUM_REQUIRED (VERSION 3.5)
else()
CMAKE_MINIMUM_REQUIRED (VERSION 2.8.12)
IF ((CMAKE_VERSION VERSION_GREATER 3.1) OR
(CMAKE_VERSION VERSION_EQUAL 3.1))
CMAKE_POLICY(SET CMP0054 NEW)
ENDIF ()
endif()
PROJECT (msgpack-cxx LANGUAGES CXX)
@@ -18,7 +24,7 @@ SET (VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION})
LIST (APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/")
SET (GNUCXX_STD_SUPPORT_VERSION "4.3")
OPTION (MSGPACK_CXX11 "Using c++11 compiler" OFF)
OPTION (MSGPACK_CXX11 "Using c++11 compiler" ON)
OPTION (MSGPACK_CXX14 "Using c++14 compiler" OFF)
OPTION (MSGPACK_CXX17 "Using c++17 compiler" OFF)
OPTION (MSGPACK_CXX20 "Using c++20 compiler" OFF)
@@ -67,6 +73,10 @@ IF (MSGPACK_32BIT)
ENDIF ()
IF (MSGPACK_USE_BOOST)
IF ((CMAKE_VERSION VERSION_GREATER 3.30) OR
(CMAKE_VERSION VERSION_EQUAL 3.30))
CMAKE_POLICY(SET CMP0167 NEW)
ENDIF ()
SET (Boost_USE_MULTITHREADED ON)
IF (MSGPACK_USE_STATIC_BOOST)
@@ -143,6 +153,13 @@ IF (MSGPACK_GEN_COVERAGE)
ENDIF ()
IF (MSGPACK_BUILD_TESTS)
IF (${CMAKE_CXX_STANDARD} EQUAL 98)
MESSAGE (FATAL_ERROR "Tests requires C++11 or newer")
ENDIF ()
IF ((CMAKE_VERSION VERSION_GREATER 3.27) OR
(CMAKE_VERSION VERSION_EQUAL 3.27))
CMAKE_POLICY(SET CMP0145 OLD)
ENDIF ()
IF (NOT MSGPACK_USE_BOOST)
MESSAGE(FATAL_ERROR "Test requires -DMSGPACK_USE_BOOST=ON")
ENDIF ()

View File

@@ -12,7 +12,7 @@ Same as QuickStart for C Language.
## First program
Include `msgpack.hpp` header and link `msgpack` library to use MessagePack on your program.
Include `msgpack.hpp` header to use MessagePack on your program.
```cpp
#include <msgpack.hpp>

View File

@@ -1,7 +1,7 @@
`msgpack` for C++
===================
Version 6.1.0 [![Build Status](https://github.com/msgpack/msgpack-c/workflows/CI/badge.svg?branch=cpp_master)](https://github.com/msgpack/msgpack-c/actions) [![Build status](https://ci.appveyor.com/api/projects/status/8kstcgt79qj123mw/branch/cpp_master?svg=true)](https://ci.appveyor.com/project/redboltz/msgpack-c/branch/cpp_master)
Version 7.0.0 [![Build Status](https://github.com/msgpack/msgpack-c/workflows/CI/badge.svg?branch=cpp_master)](https://github.com/msgpack/msgpack-c/actions) [![Build status](https://ci.appveyor.com/api/projects/status/8kstcgt79qj123mw/branch/cpp_master?svg=true)](https://ci.appveyor.com/project/redboltz/msgpack-c/branch/cpp_master)
[![codecov](https://codecov.io/gh/msgpack/msgpack-c/branch/cpp_master/graph/badge.svg)](https://codecov.io/gh/msgpack/msgpack-c/branch/cpp_master)
It's like JSON but smaller and faster.

View File

@@ -1,4 +1,4 @@
version: 6.1.0.{build}
version: 7.0.0.{build}
branches:
only:
@@ -6,16 +6,6 @@ branches:
environment:
matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
cpp11: -DMSGPACK_CXX11=OFF
msvc: '"Visual Studio 12 2013"'
boost_prefix: C:\Libraries\boost_1_58_0
boost_subdir: lib32-msvc-12.0
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
cpp11: -DMSGPACK_CXX11=OFF
msvc: '"Visual Studio 14 2015"'
boost_prefix: C:\Libraries\boost_1_69_0
boost_subdir: lib32-msvc-14.0
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
cpp11: -DMSGPACK_CXX11=ON
msvc: '"Visual Studio 14 2015"'
@@ -23,10 +13,10 @@ environment:
boost_subdir: lib32-msvc-14.0
build_script:
- ps: |
appveyor DownloadFile http://zlib.net/zlib-1.2.13.tar.gz -FileName zlib-1.2.13.tar.gz
7z x zlib-1.2.13.tar.gz 2> $null
7z x zlib-1.2.13.tar 2> $null
cd zlib-1.2.13
appveyor DownloadFile http://zlib.net/zlib-1.3.1.tar.gz -FileName zlib-1.3.1.tar.gz
7z x zlib-1.3.1.tar.gz 2> $null
7z x zlib-1.3.1.tar 2> $null
cd zlib-1.3.1
md build
md prefix
@@ -34,7 +24,7 @@ build_script:
cmake `
-G $env:msvc `
-D CMAKE_INSTALL_PREFIX="$env:APPVEYOR_BUILD_FOLDER\zlib-1.2.13\prefix" `
-D CMAKE_INSTALL_PREFIX="$env:APPVEYOR_BUILD_FOLDER\zlib-1.3.1\prefix" `
..
if ($LastExitCode -ne 0) { exit $LastExitCode }
@@ -52,7 +42,7 @@ build_script:
-D MSGPACK_BUILD_EXAMPLES=ON `
-D MSGPACK_BUILD_TESTS=ON `
-D CMAKE_EXE_LINKER_FLAGS=/LIBPATH:"$env:boost_prefix\$env:boost_subdir" `
-D CMAKE_PREFIX_PATH="$env:boost_prefix;$env:APPVEYOR_BUILD_FOLDER\zlib-1.2.13\prefix" `
-D CMAKE_PREFIX_PATH="$env:boost_prefix;$env:APPVEYOR_BUILD_FOLDER\zlib-1.3.1\prefix" `
-D CMAKE_INSTALL_PREFIX="$env:APPVEYOR_BUILD_FOLDER\prefix" `
-D CMAKE_CXX_FLAGS="/D_VARIADIC_MAX=10 /EHsc /DBOOST_ALL_DYN_LINK" `
..
@@ -62,5 +52,5 @@ build_script:
if ($LastExitCode -ne 0) { exit $LastExitCode }
test_script:
- set PATH=%PATH%;%APPVEYOR_BUILD_FOLDER%\zlib-1.2.13\build\Release;%APPVEYOR_BUILD_FOLDER%\build\release;%boost_prefix%\%boost_subdir%
- set PATH=%PATH%;%APPVEYOR_BUILD_FOLDER%\zlib-1.3.1\build\Release;%APPVEYOR_BUILD_FOLDER%\build\release;%boost_prefix%\%boost_subdir%
- ctest -VV -C Release

View File

@@ -1,4 +1,4 @@
FIND_PACKAGE (Boost REQUIRED COMPONENTS system)
FIND_PACKAGE (Boost REQUIRED)
FIND_PACKAGE (Threads REQUIRED)
FIND_PACKAGE (ZLIB REQUIRED)
@@ -22,7 +22,6 @@ FOREACH (source_file ${exec_PROGRAMS})
)
TARGET_LINK_LIBRARIES (${source_file_we} PRIVATE
msgpack-cxx
Boost::system
Threads::Threads
)
IF (ZLIB_FOUND)

View File

@@ -1,5 +1,5 @@
IF (MSGPACK_USE_X3_PARSE AND MSGPACK_DEFAULT_API_VERSION VERSION_GREATER 1)
FIND_PACKAGE (Boost REQUIRED COMPONENTS context system)
FIND_PACKAGE (Boost REQUIRED COMPONENTS context)
FIND_PACKAGE (Threads REQUIRED)
LIST (APPEND exec_PROGRAMS
@@ -42,7 +42,6 @@ IF (MSGPACK_USE_X3_PARSE AND MSGPACK_DEFAULT_API_VERSION VERSION_GREATER 1)
TARGET_LINK_LIBRARIES (${source_file_we} PRIVATE
msgpack-cxx
Boost::context
Boost::system
Threads::Threads
)
IF ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")

View File

@@ -1,5 +1,5 @@
FIND_PACKAGE (Threads REQUIRED)
FIND_PACKAGE (Boost REQUIRED COMPONENTS system filesystem unit_test_framework)
FIND_PACKAGE (Boost REQUIRED COMPONENTS filesystem unit_test_framework)
LIST (APPEND check_PROGRAMS
regression_runner.cpp
@@ -19,7 +19,6 @@ FOREACH (source_file ${check_PROGRAMS})
msgpack-cxx
Threads::Threads
Boost::filesystem
Boost::system
Boost::unit_test_framework
)

View File

@@ -73,7 +73,11 @@
#if !defined(MSGPACK_NO_BOOST)
#include "adaptor/boost/fusion.hpp"
#if !defined(MSGPACK_USE_CPP03)
#include "adaptor/boost/msgpack_variant.hpp"
#endif // !defined(MSGPACK_USE_CPP03)
#include "adaptor/boost/optional.hpp"
#include "adaptor/boost/string_ref.hpp"
#include "adaptor/boost/string_view.hpp"

View File

@@ -40,11 +40,11 @@ Variant construct_variant(
std::index_sequence<current_index, indices...>
) {
if constexpr(sizeof...(Ts) == 0) {
return object.as<T>();
return Variant{std::in_place_index<current_index>, object.as<T>()};
}
else {
if (index == current_index) {
return object.as<T>();
return Variant{std::in_place_index<current_index>, object.as<T>()};
}
return construct_variant<Variant, Ts...>(
index,

View File

@@ -53,16 +53,16 @@ template <typename T>
struct has_as {
private:
template <typename U>
static auto check(U*) ->
static auto check_(U*) ->
// Check v1 specialization
typename std::is_same<
decltype(adaptor::as<U>()(std::declval<msgpack::object>())),
T
>::type;
template <typename...>
static std::false_type check(...);
static std::false_type check_(...);
public:
using type = decltype(check<T>(MSGPACK_NULLPTR));
using type = decltype(check_<T>(MSGPACK_NULLPTR));
static constexpr bool value = type::value;
};

View File

@@ -1138,17 +1138,6 @@ inline packer<Stream>& packer<Stream>::pack_unsigned_long_long(unsigned long lon
template <typename Stream>
inline packer<Stream>& packer<Stream>::pack_float(float d)
{
if(d == d) { // check for nan
// compare d to limits to avoid undefined behaviour
if(d >= 0 && d <= float(std::numeric_limits<uint64_t>::max()) && d == float(uint64_t(d))) {
pack_imp_uint64(uint64_t(d));
return *this;
} else if(d < 0 && d >= float(std::numeric_limits<int64_t>::min()) && d == float(int64_t(d))) {
pack_imp_int64(int64_t(d));
return *this;
}
}
union { float f; uint32_t i; } mem;
mem.f = d;
char buf[5];
@@ -1160,17 +1149,6 @@ inline packer<Stream>& packer<Stream>::pack_float(float d)
template <typename Stream>
inline packer<Stream>& packer<Stream>::pack_double(double d)
{
if(d == d) { // check for nan
// compare d to limits to avoid undefined behaviour
if(d >= 0 && d <= double(std::numeric_limits<uint64_t>::max()) && d == double(uint64_t(d))) {
pack_imp_uint64(uint64_t(d));
return *this;
} else if(d < 0 && d >= double(std::numeric_limits<int64_t>::min()) && d == double(int64_t(d))) {
pack_imp_int64(int64_t(d));
return *this;
}
}
union { double f; uint64_t i; } mem;
mem.f = d;
char buf[9];

View File

@@ -79,7 +79,7 @@ template <typename T>
struct has_as {
private:
template <typename U>
static auto check(U*) ->
static auto check_(U*) ->
typename std::enable_if<
// check v2 specialization
std::is_same<
@@ -92,9 +92,9 @@ private:
std::true_type
>::type;
template <typename...>
static std::false_type check(...);
static std::false_type check_(...);
public:
using type = decltype(check<T>(MSGPACK_NULLPTR));
using type = decltype(check_<T>(MSGPACK_NULLPTR));
static constexpr bool value = type::value;
};

View File

@@ -36,7 +36,7 @@ template <typename T>
struct has_as {
private:
template <typename U>
static auto check(U*) ->
static auto check_(U*) ->
typename std::enable_if<
// check v3 specialization
std::is_same<
@@ -52,9 +52,9 @@ private:
std::true_type
>::type;
template <typename...>
static std::false_type check(...);
static std::false_type check_(...);
public:
using type = decltype(check<T>(MSGPACK_NULLPTR));
using type = decltype(check_<T>(MSGPACK_NULLPTR));
static constexpr bool value = type::value;
};

View File

@@ -1,3 +1,3 @@
#define MSGPACK_VERSION_MAJOR 6
#define MSGPACK_VERSION_MINOR 1
#define MSGPACK_VERSION_MAJOR 7
#define MSGPACK_VERSION_MINOR 0
#define MSGPACK_VERSION_REVISION 0

View File

@@ -1,6 +1,6 @@
FIND_PACKAGE (Threads REQUIRED)
FIND_PACKAGE (ZLIB)
FIND_PACKAGE (Boost REQUIRED COMPONENTS unit_test_framework system)
FIND_PACKAGE (Boost REQUIRED COMPONENTS unit_test_framework)
LIST (APPEND check_PROGRAMS
array_ref.cpp
@@ -8,7 +8,6 @@ LIST (APPEND check_PROGRAMS
boost_optional.cpp
boost_string_ref.cpp
boost_string_view.cpp
boost_variant.cpp
buffer.cpp
carray.cpp
cases.cpp
@@ -43,6 +42,7 @@ ENDIF ()
IF (MSGPACK_CXX11 OR MSGPACK_CXX14 OR MSGPACK_CXX17 OR MSGPACK_CXX20)
LIST (APPEND check_PROGRAMS
boost_variant.cpp
iterator_cpp11.cpp
msgpack_cpp11.cpp
reference_cpp11.cpp
@@ -79,7 +79,6 @@ FOREACH (source_file ${check_PROGRAMS})
TARGET_LINK_LIBRARIES (${source_file_we}
msgpack-cxx
Boost::system
Boost::unit_test_framework
Threads::Threads
ZLIB::ZLIB

View File

@@ -154,8 +154,6 @@ BOOST_AUTO_TEST_CASE(simple_buffer_float)
v.push_back(-0.0);
v.push_back(1.0);
v.push_back(-1.0);
v.push_back(1.1f);
v.push_back(-1.1f);
v.push_back(numeric_limits<float>::min());
v.push_back(numeric_limits<float>::max());
v.push_back(nanf("tag"));
@@ -188,12 +186,6 @@ BOOST_AUTO_TEST_CASE(simple_buffer_float)
BOOST_CHECK(std::isinf(val2));
else
BOOST_CHECK(fabs(val2 - val1) <= kEPS);
// check for compact storing of float
if (val1 == val1 && val1 >= float(std::numeric_limits<int64_t>::min()) && val1 <= float(std::numeric_limits<int64_t>::max()) && val1 == float(int64_t(val1)))
BOOST_REQUIRE_EQUAL(sbuf.size(),1);
else
BOOST_REQUIRE_EQUAL(sbuf.data()[0],char(0xca));
}
}
@@ -244,8 +236,6 @@ BOOST_AUTO_TEST_CASE(simple_buffer_double)
v.push_back(-0.0);
v.push_back(1.0);
v.push_back(-1.0);
v.push_back(1.1);
v.push_back(-1.1);
v.push_back(numeric_limits<double>::min());
v.push_back(numeric_limits<double>::max());
v.push_back(nanf("tag"));
@@ -282,12 +272,6 @@ BOOST_AUTO_TEST_CASE(simple_buffer_double)
BOOST_CHECK(std::isinf(val2));
else
BOOST_CHECK(fabs(val2 - val1) <= kEPS);
// check for compact storing of double
if (val1 == val1 && val1 >= double(std::numeric_limits<int64_t>::min()) && val1 <= double(std::numeric_limits<int64_t>::max()) && val1 == double(int64_t(val1)))
BOOST_REQUIRE_EQUAL(sbuf.size(),1);
else
BOOST_REQUIRE_EQUAL(uint8_t(sbuf.data()[0]),uint8_t(0xcb));
}
}

View File

@@ -474,6 +474,28 @@ BOOST_AUTO_TEST_CASE(variant_pack_unpack_as) {
oh.get().as<std::variant<bool, int, float, double> >();
BOOST_CHECK(val1 == val2);
BOOST_CHECK_THROW((oh.get().as<std::variant<bool>>()), msgpack::type_error);
{
std::stringstream same_ss;
std::variant<int, float, int> same_expected{std::in_place_index<2>, 2};
msgpack::pack(same_ss, same_expected);
std::string const& same_str = same_ss.str();
msgpack::object_handle same_oh =
msgpack::unpack(same_str.data(), same_str.size());
std::variant<int, float, int> same_actual = same_oh->as<std::variant<int, float, int>>();
BOOST_CHECK(same_expected == same_actual);
}
{
std::stringstream same_ss;
std::variant<int, int> same_expected{std::in_place_index<1>, 2};
msgpack::pack(same_ss, same_expected);
std::string const& same_str = same_ss.str();
msgpack::object_handle same_oh =
msgpack::unpack(same_str.data(), same_str.size());
std::variant<int, int> same_actual = same_oh->as<std::variant<int, int>>();
BOOST_CHECK(same_expected == same_actual);
}
}
BOOST_AUTO_TEST_CASE(variant_with_zone) {