Skip to content

Commit

Permalink
fix format
Browse files Browse the repository at this point in the history
  • Loading branch information
poor-circle committed Nov 9, 2023
1 parent 34aba19 commit f54b372
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
12 changes: 6 additions & 6 deletions include/ylt/struct_pack.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,11 @@ serialize_with_offset(std::size_t offset, const Args &...args) {

template <uint64_t conf,
#if __cpp_concepts >= 201907L
detail::struct_pack_buffer Buffer = std::vector<char>,
detail::struct_pack_buffer Buffer = std::vector<char>,
#else
typename Buffer = std::vector<char>,
typename Buffer = std::vector<char>,
#endif
typename... Args>
typename... Args>
[[nodiscard]] STRUCT_PACK_INLINE Buffer serialize(const Args &...args) {
#if __cpp_concepts < 201907L
static_assert(detail::struct_pack_buffer<Buffer>,
Expand All @@ -252,11 +252,11 @@ template <uint64_t conf,

template <uint64_t conf,
#if __cpp_concepts >= 201907L
detail::struct_pack_buffer Buffer = std::vector<char>,
detail::struct_pack_buffer Buffer = std::vector<char>,
#else
typename Buffer = std::vector<char>,
typename Buffer = std::vector<char>,
#endif
typename... Args>
typename... Args>
[[nodiscard]] STRUCT_PACK_INLINE Buffer
serialize_with_offset(std::size_t offset, const Args &...args) {
#if __cpp_concepts < 201907L
Expand Down
4 changes: 1 addition & 3 deletions src/struct_pack/examples/serialize_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ struct rect {
void serialize_config() {
// serialize with config
rect r{1, -1, 0, 5};
auto buffer =
struct_pack::serialize<struct_pack::DISABLE_ALL_META_INFO>(
r);
auto buffer = struct_pack::serialize<struct_pack::DISABLE_ALL_META_INFO>(r);
// only need 4 bytes
assert(buffer.size() == 4);
// deserialize with config
Expand Down
7 changes: 3 additions & 4 deletions src/struct_pack/tests/test_serialize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -708,8 +708,8 @@ TEST_CASE("test type info config") {
auto size =
get_needed_size<sp_config::DISABLE_TYPE_INFO>(person{24, "Betty"});
CHECK(size == 14);
auto buffer = serialize<sp_config::DISABLE_TYPE_INFO>(
person{24, "Betty"});
auto buffer =
serialize<sp_config::DISABLE_TYPE_INFO>(person{24, "Betty"});
CHECK(buffer.size() == size);
static_assert(
detail::check_if_add_type_literal<sp_config::DISABLE_TYPE_INFO,
Expand All @@ -719,8 +719,7 @@ TEST_CASE("test type info config") {
auto size =
get_needed_size<sp_config::ENABLE_TYPE_INFO>(person{24, "Betty"});
CHECK(size == 21);
auto buffer = serialize<sp_config::ENABLE_TYPE_INFO>(
person{24, "Betty"});
auto buffer = serialize<sp_config::ENABLE_TYPE_INFO>(person{24, "Betty"});
CHECK(buffer.size() == size);
static_assert(
detail::check_if_add_type_literal<sp_config::ENABLE_TYPE_INFO,
Expand Down

0 comments on commit f54b372

Please sign in to comment.