mirror of
https://github.com/fraillt/bitsery.git
synced 2026-06-18 13:19:11 +00:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ee992d8b57 | ||
|
|
4dcdd594da | ||
|
|
b714459a2b | ||
|
|
be2f295310 | ||
|
|
cd73aca2f5 | ||
|
|
94f7adaf6c | ||
|
|
ceeb189c8b | ||
|
|
90243480ec |
28
.github/workflows/on_linux.yml
vendored
28
.github/workflows/on_linux.yml
vendored
@@ -9,53 +9,37 @@ on:
|
||||
jobs:
|
||||
build:
|
||||
name: ${{ matrix.config.name }}
|
||||
runs-on: ubuntu-18.04
|
||||
runs-on: ubuntu-24.04
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
config:
|
||||
- name: "Ubuntu 18.04 with Clang 3.9"
|
||||
cxx_ver: 11
|
||||
compiler: clang
|
||||
compiler_ver: 3.9
|
||||
- name: "Ubuntu 18.04 with GCC 5.0"
|
||||
cxx_ver: 11
|
||||
- name: "Ubuntu Latest with GCC 14"
|
||||
compiler: gcc
|
||||
compiler_ver: 5
|
||||
- name: "Ubuntu 18.04 with GCC 11.0"
|
||||
cxx_ver: 17
|
||||
compiler: gcc
|
||||
compiler_ver: 11
|
||||
- name: "Ubuntu 18.04 with Clang 13"
|
||||
cxx_ver: 17
|
||||
compiler_ver: 14
|
||||
- name: "Ubuntu Latests with Clang 18"
|
||||
compiler: clang
|
||||
compiler_ver: 13
|
||||
compiler_ver: 18
|
||||
steps:
|
||||
- name: Prepare specific Clang version
|
||||
if: ${{ matrix.config.compiler == 'clang' }}
|
||||
run: |
|
||||
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
|
||||
sudo apt-add-repository "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-13 main"
|
||||
sudo apt update
|
||||
sudo apt install clang-${{ matrix.config.compiler_ver}}
|
||||
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-${{ matrix.config.compiler_ver}} 100
|
||||
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/clang-${{ matrix.config.compiler_ver}} 100
|
||||
- name: Prepare specific GCC version
|
||||
if: ${{ matrix.config.compiler == 'gcc' }}
|
||||
run: |
|
||||
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
|
||||
sudo apt update
|
||||
sudo apt install g++-${{ matrix.config.compiler_ver}}
|
||||
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++-${{ matrix.config.compiler_ver}} 100
|
||||
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-${{ matrix.config.compiler_ver}} 100
|
||||
- name: Installing GTest
|
||||
run: |
|
||||
sudo add-apt-repository ppa:team-xbmc/ppa
|
||||
sudo apt-get update
|
||||
sudo apt-get install libgmock-dev
|
||||
- uses: actions/checkout@v3
|
||||
- name: Configure
|
||||
run: cmake -S . -B build -DBITSERY_BUILD_TESTS=ON -DBITSERY_BUILD_EXAMPLES=ON -DCMAKE_CXX_STANDARD=${{ matrix.config.cxx_ver }}
|
||||
run: cmake -S . -B build -DBITSERY_BUILD_TESTS=ON -DBITSERY_BUILD_EXAMPLES=ON
|
||||
- name: Build
|
||||
run: cmake --build build
|
||||
- name: Run tests
|
||||
|
||||
4
.github/workflows/on_mac.yml
vendored
4
.github/workflows/on_mac.yml
vendored
@@ -14,9 +14,9 @@ jobs:
|
||||
run: |
|
||||
git clone https://github.com/google/googletest.git
|
||||
cd googletest
|
||||
git checkout release-1.11.0
|
||||
git checkout v1.14.0
|
||||
cmake -S . -B build
|
||||
cmake --build build --target install
|
||||
sudo cmake --build build --target install
|
||||
- uses: actions/checkout@v3
|
||||
- name: Configure
|
||||
run: cmake -S . -B build -DBITSERY_BUILD_TESTS=ON -DBITSERY_BUILD_EXAMPLES=ON -DCMAKE_CXX_STANDARD=17
|
||||
|
||||
2
.github/workflows/on_windows.yml
vendored
2
.github/workflows/on_windows.yml
vendored
@@ -15,7 +15,7 @@ jobs:
|
||||
run: |
|
||||
git clone https://github.com/google/googletest.git
|
||||
cd googletest
|
||||
git checkout release-1.11.0
|
||||
git checkout v1.14.0
|
||||
cmake -S . -B build -Dgtest_force_shared_crt=ON
|
||||
cmake --build build --config Release --target install
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
12
CHANGELOG.md
12
CHANGELOG.md
@@ -1,3 +1,15 @@
|
||||
# [5.2.4](https://github.com/fraillt/bitsery/compare/v5.2.3...v5.2.4) (2024-07-30)
|
||||
|
||||
### Improvements
|
||||
* implement brief syntax for std::optional and std::bitset. #116 (thanks to [Destroyerrrocket](https://github.com/Destroyerrrocket))
|
||||
* improve performance for buffer adapters. #118 (thanks to [Destroyerrrocket](https://github.com/Destroyerrrocket))
|
||||
* check if should swap by taking into account actual type (in addition to configuration). #105 (thanks to [SoftdriveFelix](https://github.com/SoftdriveFelix))
|
||||
* fix compile errors for latest compilers. #106 (thanks to [NBurley93](https://github.com/NBurley93))
|
||||
|
||||
### Other notes
|
||||
* change cmake_minimum_required to 3.25.
|
||||
* change compilers for ubuntu (gcc 14 and clang 18).
|
||||
|
||||
# [5.2.3](https://github.com/fraillt/bitsery/compare/v5.2.2...v5.2.3) (2022-12-01)
|
||||
|
||||
### Improvements
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
cmake_minimum_required(VERSION 3.25)
|
||||
project(bitsery
|
||||
LANGUAGES CXX
|
||||
VERSION 5.2.2)
|
||||
VERSION 5.2.4)
|
||||
|
||||
#======== build options ===================================
|
||||
option(BITSERY_BUILD_EXAMPLES "Build examples" OFF)
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
#SOFTWARE.
|
||||
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
cmake_minimum_required(VERSION 3.25)
|
||||
project(bitsery_examples CXX)
|
||||
|
||||
if (NOT TARGET Bitsery::bitsery)
|
||||
|
||||
@@ -39,7 +39,7 @@ private:
|
||||
template<typename S>
|
||||
void serialize(S& s)
|
||||
{
|
||||
// forward/backward compatibility for monsters
|
||||
// forward/backward compatibility for weapons
|
||||
s.ext(*this, bitsery::ext::Growable{}, [](S& s, Weapon& o1) {
|
||||
s.text1b(o1.name, 20);
|
||||
s.value2b(o1.damage);
|
||||
@@ -103,8 +103,6 @@ main()
|
||||
|
||||
// create buffer to store data to
|
||||
Buffer buffer{};
|
||||
// since we're using different configuration, we cannot use quickSerialization
|
||||
// function.
|
||||
auto writtenSize = bitsery::quickSerialization<OutputAdapter>(buffer, data);
|
||||
|
||||
MyTypes::Monster res{};
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#ifndef BITSERY_ADAPTER_BUFFER_H
|
||||
#define BITSERY_ADAPTER_BUFFER_H
|
||||
|
||||
#include "../bitsery.h"
|
||||
#include "../details/adapter_bit_packing.h"
|
||||
#include "../traits/core/traits.h"
|
||||
#include <algorithm>
|
||||
@@ -268,16 +269,16 @@ private:
|
||||
|
||||
void maybeResize(size_t newOffset, std::true_type)
|
||||
{
|
||||
if (newOffset > _bufferSize) {
|
||||
traits::BufferAdapterTraits<Buffer>::increaseBufferSize(
|
||||
*_buffer, _currOffset, newOffset);
|
||||
_beginIt = std::begin(*_buffer);
|
||||
_bufferSize = traits::ContainerTraits<Buffer>::size(*_buffer);
|
||||
}
|
||||
if (newOffset > _bufferSize)
|
||||
BITSERY_UNLIKELY
|
||||
{
|
||||
doResize(newOffset);
|
||||
}
|
||||
}
|
||||
|
||||
void maybeResize(size_t newOffset, std::false_type)
|
||||
{
|
||||
static_cast<void>(newOffset);
|
||||
assert(newOffset <= _bufferSize);
|
||||
}
|
||||
|
||||
@@ -288,6 +289,14 @@ private:
|
||||
std::copy_n(data, size, _beginIt + static_cast<diff_t>(_currOffset));
|
||||
_currOffset = newOffset;
|
||||
}
|
||||
|
||||
BITSERY_NOINLINE void doResize(size_t newOffset)
|
||||
{
|
||||
traits::BufferAdapterTraits<Buffer>::increaseBufferSize(
|
||||
*_buffer, _currOffset, newOffset);
|
||||
_beginIt = std::begin(*_buffer);
|
||||
_bufferSize = traits::ContainerTraits<Buffer>::size(*_buffer);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
#define BITSERY_MAJOR_VERSION 5
|
||||
#define BITSERY_MINOR_VERSION 2
|
||||
#define BITSERY_PATCH_VERSION 2
|
||||
#define BITSERY_PATCH_VERSION 4
|
||||
|
||||
#define BITSERY_QUOTE_MACRO(name) #name
|
||||
#define BITSERY_BUILD_VERSION_STR(major, minor, patch) \
|
||||
@@ -36,6 +36,67 @@
|
||||
BITSERY_BUILD_VERSION_STR( \
|
||||
BITSERY_MAJOR_VERSION, BITSERY_MINOR_VERSION, BITSERY_PATCH_VERSION)
|
||||
|
||||
#define BITSERY_DO_PRAGMA(x) _Pragma(#x)
|
||||
#ifdef __GNUC__
|
||||
#define BITSERY_DISABLE_WARNINGS(...) \
|
||||
BITSERY_DO_PRAGMA(GCC diagnostic push) \
|
||||
BITSERY_DO_PRAGMA(GCC diagnostic ignored __VA_ARGS__)
|
||||
#define BITSERY_ENABLE_WARNINGS() BITSERY_DO_PRAGMA(GCC diagnostic pop)
|
||||
#elif defined(_MSC_VER)
|
||||
#define BITSERY_DISABLE_WARNINGS(...) \
|
||||
BITSERY_DO_PRAGMA(GCC diagnostic push) \
|
||||
BITSERY_DO_PRAGMA(GCC diagnostic ignored __VA_ARGS__) \
|
||||
BITSERY_DO_PRAGMA(GCC diagnostic pop)
|
||||
#define BITSERY_ENABLE_WARNINGS() BITSERY_DO_PRAGMA(GCC diagnostic pop)
|
||||
#else
|
||||
#define BITSERY_DISABLE_WARNINGS(...)
|
||||
#define BITSERY_ENABLE_WARNINGS()
|
||||
#endif
|
||||
|
||||
#ifdef __clang__
|
||||
#define BITSERY_ATTRIBUTE(...) \
|
||||
BITSERY_DISABLE_WARNINGS("-Wfuture-attribute-extensions") \
|
||||
[[__VA_ARGS__]] BITSERY_ENABLE_WARNINGS()
|
||||
#elif defined(__GNUC__)
|
||||
#define BITSERY_ATTRIBUTE(...) [[__VA_ARGS__]]
|
||||
#elif defined(_MSC_VER)
|
||||
#define BITSERY_ATTRIBUTE(...) [[__VA_ARGS__]]
|
||||
#else
|
||||
#define BITSERY_ATTRIBUTE(...) [[__VA_ARGS__]]
|
||||
#endif
|
||||
|
||||
#if __has_cpp_attribute(likely)
|
||||
#define BITSERY_LIKELY BITSERY_ATTRIBUTE(likey)
|
||||
#else
|
||||
#define BITSERY_LIKELY
|
||||
#endif
|
||||
|
||||
#if __has_cpp_attribute(unlikely)
|
||||
#define BITSERY_UNLIKELY BITSERY_ATTRIBUTE(unlikely)
|
||||
#else
|
||||
#define BITSERY_UNLIKELY
|
||||
#endif
|
||||
|
||||
#if __GNUC__
|
||||
#define BITSERY_NOINLINE __attribute__((noinline))
|
||||
#elif defined(_MSC_VER)
|
||||
#define BITSERY_NOINLINE __declspec(noinline)
|
||||
#else
|
||||
#define BITSERY_NOINLINE
|
||||
#endif
|
||||
|
||||
#if __GNUC__
|
||||
#define BITSERY_ASSUME(cond) \
|
||||
do { \
|
||||
if (!(cond)) \
|
||||
__builtin_unreachable(); \
|
||||
} while (0)
|
||||
#elif defined(_MSC_VER)
|
||||
#define BITSERY_ASSUME(cond) __assume(cond)
|
||||
#else
|
||||
#define BITSERY_ASSUME(cond)
|
||||
#endif
|
||||
|
||||
#include "deserializer.h"
|
||||
#include "serializer.h"
|
||||
|
||||
|
||||
36
include/bitsery/brief_syntax/bitset.h
Normal file
36
include/bitsery/brief_syntax/bitset.h
Normal file
@@ -0,0 +1,36 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2018 Mindaugas Vinkelis
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#ifndef BITSERY_BRIEF_SYNTAX_TYPE_STD_BITSET_H
|
||||
#define BITSERY_BRIEF_SYNTAX_TYPE_STD_BITSET_H
|
||||
|
||||
#include "../ext/std_bitset.h"
|
||||
|
||||
namespace bitsery {
|
||||
template<typename S, size_t N>
|
||||
void
|
||||
serialize(S& s, std::bitset<N>& obj)
|
||||
{
|
||||
s.ext(obj, ext::StdBitset{});
|
||||
}
|
||||
}
|
||||
#endif
|
||||
36
include/bitsery/brief_syntax/optional.h
Normal file
36
include/bitsery/brief_syntax/optional.h
Normal file
@@ -0,0 +1,36 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2018 Mindaugas Vinkelis
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#ifndef BITSERY_BRIEF_SYNTAX_TYPE_STD_OPTIONAL_H
|
||||
#define BITSERY_BRIEF_SYNTAX_TYPE_STD_OPTIONAL_H
|
||||
|
||||
#include "../ext/std_optional.h"
|
||||
|
||||
namespace bitsery {
|
||||
template<typename S, typename Ts>
|
||||
void
|
||||
serialize(S& s, std::optional<Ts>& obj)
|
||||
{
|
||||
s.ext(obj, ext::StdOptional{});
|
||||
}
|
||||
} // namespace bitsery
|
||||
#endif
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <climits>
|
||||
#include <cstdint>
|
||||
|
||||
namespace bitsery {
|
||||
|
||||
@@ -194,10 +195,11 @@ getSystemEndianness()
|
||||
: EndiannessType::BigEndian;
|
||||
}
|
||||
|
||||
template<typename Config>
|
||||
template<typename Config, typename T>
|
||||
using ShouldSwap =
|
||||
std::integral_constant<bool,
|
||||
Config::Endianness != details::getSystemEndianness()>;
|
||||
Config::Endianness != details::getSystemEndianness() &&
|
||||
sizeof(T) != 1>;
|
||||
|
||||
/**
|
||||
* helper types to work with bits
|
||||
@@ -287,7 +289,7 @@ struct OutputAdapterBaseCRTP
|
||||
{
|
||||
static_assert(std::is_integral<T>(), "");
|
||||
static_assert(sizeof(T) == SIZE, "");
|
||||
writeSwappedValue(&v, ShouldSwap<typename Adapter::TConfig>{});
|
||||
writeSwappedValue(&v, ShouldSwap<typename Adapter::TConfig, T>{});
|
||||
}
|
||||
|
||||
template<size_t SIZE, typename T>
|
||||
@@ -295,7 +297,7 @@ struct OutputAdapterBaseCRTP
|
||||
{
|
||||
static_assert(std::is_integral<T>(), "");
|
||||
static_assert(sizeof(T) == SIZE, "");
|
||||
writeSwappedBuffer(buf, count, ShouldSwap<typename Adapter::TConfig>{});
|
||||
writeSwappedBuffer(buf, count, ShouldSwap<typename Adapter::TConfig, T>{});
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
@@ -360,7 +362,7 @@ struct InputAdapterBaseCRTP
|
||||
static_assert(sizeof(T) == SIZE, "");
|
||||
static_cast<Adapter*>(this)->template readInternalValue<sizeof(T)>(
|
||||
reinterpret_cast<typename Adapter::TValue*>(&v));
|
||||
swapDataBits(v, ShouldSwap<typename Adapter::TConfig>{});
|
||||
swapDataBits(v, ShouldSwap<typename Adapter::TConfig, T>{});
|
||||
}
|
||||
|
||||
template<size_t SIZE, typename T>
|
||||
@@ -370,7 +372,7 @@ struct InputAdapterBaseCRTP
|
||||
static_assert(sizeof(T) == SIZE, "");
|
||||
static_cast<Adapter*>(this)->readInternalBuffer(
|
||||
reinterpret_cast<typename Adapter::TValue*>(buf), sizeof(T) * count);
|
||||
swapDataBits(buf, count, ShouldSwap<typename Adapter::TConfig>{});
|
||||
swapDataBits(buf, count, ShouldSwap<typename Adapter::TConfig, T>{});
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#define BITSERY_EXT_GROWABLE_H
|
||||
|
||||
#include "../traits/core/traits.h"
|
||||
#include <cstdint>
|
||||
|
||||
namespace bitsery {
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#include "../traits/core/traits.h"
|
||||
#include <bitset>
|
||||
#include <cstdint>
|
||||
|
||||
namespace bitsery {
|
||||
namespace ext {
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#ifndef BITSERY_TRAITS_CORE_STD_DEFAULTS_H
|
||||
#define BITSERY_TRAITS_CORE_STD_DEFAULTS_H
|
||||
|
||||
#include "../../bitsery.h"
|
||||
#include "../../details/serialization_common.h"
|
||||
#include "traits.h"
|
||||
|
||||
@@ -103,8 +104,11 @@ struct StdContainerForBufferAdapter<T, true>
|
||||
static_cast<size_t>(static_cast<double>(container.size()) * 1.5) + 128;
|
||||
// make data cache friendly
|
||||
newSize -= newSize % 64; // 64 is cache line size
|
||||
container.resize(
|
||||
(std::max)(newSize > minSize ? newSize : minSize, container.capacity()));
|
||||
auto resize =
|
||||
(std::max)(newSize > minSize ? newSize : minSize, container.capacity());
|
||||
BITSERY_ASSUME(resize >= container.size());
|
||||
BITSERY_ASSUME(resize >= container.capacity());
|
||||
container.resize(resize);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
#SOFTWARE.
|
||||
|
||||
cmake_minimum_required(VERSION 3.11)
|
||||
cmake_minimum_required(VERSION 3.25)
|
||||
project(bitsery_tests
|
||||
LANGUAGES CXX)
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <bitsery/brief_syntax/list.h>
|
||||
#include <bitsery/brief_syntax/map.h>
|
||||
#include <bitsery/brief_syntax/memory.h>
|
||||
|
||||
#include <bitsery/brief_syntax/queue.h>
|
||||
#include <bitsery/brief_syntax/set.h>
|
||||
#include <bitsery/brief_syntax/stack.h>
|
||||
@@ -39,6 +40,10 @@
|
||||
#if __cplusplus > 201402L
|
||||
#include <bitsery/brief_syntax/tuple.h>
|
||||
#include <bitsery/brief_syntax/variant.h>
|
||||
#include <bitsery/brief_syntax/optional.h>
|
||||
#if __cplusplus > 202002L
|
||||
#include <bitsery/brief_syntax/bitset.h>
|
||||
#endif
|
||||
#elif defined(_MSC_VER)
|
||||
#pragma message( \
|
||||
"C++17 and /Zc:__cplusplus option is required to enable std::tuple and std::variant brief syntax tests")
|
||||
@@ -490,6 +495,22 @@ TEST(BriefSyntax, StdVariant)
|
||||
EXPECT_TRUE(procBriefSyntax(t1) == t1);
|
||||
}
|
||||
|
||||
TEST(BriefSyntax, StdOptional)
|
||||
{
|
||||
std::optional<uint32_t> opt{ 54654 };
|
||||
EXPECT_TRUE(procBriefSyntax(opt) == opt);
|
||||
}
|
||||
|
||||
#if __cplusplus > 202002L
|
||||
|
||||
TEST(BriefSyntax, StdBitset)
|
||||
{
|
||||
std::bitset<17> bits{ 0b10101010101010101 };
|
||||
EXPECT_TRUE(procBriefSyntax(bits) == bits);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
TEST(BriefSyntax, NestedTypes)
|
||||
|
||||
Reference in New Issue
Block a user