Giter Club home page Giter Club logo

alpaca's People

Contributors

f-michaut avatar finger563 avatar ghostvaibhav avatar lolpie244 avatar lrodorigo-apo avatar p-ranav avatar regardsim avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

alpaca's Issues

Are structs containing functions serializable?

Thank you for the library! Question: is it guaranteed that, when feeding a given struct with functions, only the member variables will be serialized? If so, does the function declaration position matter?

Use case: a verify() function throwing a boolean after some sanity checks in the struct data.

@p-ranav

Deserialization of tuples does not work on g++11

It looks like tuple deserialization runs in a decltype(auto) bug in g++-11 as shown in this godbolt based on alpaca::detail::get.

A workaround seems to be to change the return type of alpaca::detail::get from decltype(auto) to auto & and change the bare return statements (that should never be call) to return a dummy int &. While ugly, since Since g++-11 is installed by default on Ubuntu 22.04 this is probably worth putting in the workaround.

Failed to compile for struct with constructors which have more than 1 arguments

The following 3 cases could pass compile

struct Foo1 {
    int data;
};

struct Foo2 {
    int data;
    Foo2() = default;
};

struct Foo3 {
    int data;
    Foo3(const int data): data{data} {}
};

But once the constructor accepts more than one arugments, we will get an error, like this:

struct Foo4 {
    int data;
    Foo4() = default; // with or without it just lead to the same error
    Foo4(const int data, const bool bar): data{data} {}
}
FAILED: CMakeFiles/symusic.dir/src/io/alpaca.cpp.obj 
C:\PROGRA~1\MICROS~1\2022\COMMUN~1\VC\Tools\MSVC\1438~1.331\bin\Hostx64\x64\cl.exe  /nologo /TP -DFMT_HEADER_ONLY=1 -IC:\Users\nhy\symusic-libra\include -IC:\Users\nhy\symusic-libra\3rdparty\minimidi\include -IC:\Users\nhy\symusic-libra\3rdparty\pdqsort -IC:\Users\nhy\symusic-libra\3rdparty\zpp_bits -IC:\Users\nhy\symusic-libra\3rdparty\fmt\include -IC:\Users\nhy\symusic-libra\3rdparty\alpaca\include /DWIN32 /D_WINDOWS /EHsc /Zi /Ob0 /Od /RTC1 -std:c++20 -MDd /GL -bigobj /showIncludes /FoCMakeFiles\symusic.dir\src\io\alpaca.cpp.obj /FdCMakeFiles\symusic.dir\symusic.pdb /FS -c C:\Users\nhy\symusic-libra\src\io\alpaca.cpp
C:\Users\nhy\symusic-libra\3rdparty\alpaca\include\alpaca/detail/struct_nth_field.h(21): error C3448: the number of identifiers must match the number of array elements or members in a structured binding declaration
C:\Users\nhy\symusic-libra\3rdparty\alpaca\include\alpaca/detail/struct_nth_field.h(21): note: the template instantiation context (the oldest one first) is
C:\Users\nhy\symusic-libra\src\io\alpaca.cpp(104): note: see reference to function template instantiation 'std::vector<uint8_t,std::allocator<uint8_t>> symusic::details::serailize_alpaca<symusic::Foo4>(const symusic::Foo4 &)' being compiled
C:\Users\nhy\symusic-libra\src\io\alpaca.cpp(29): note: see reference to function template instantiation 'size_t alpaca::serialize<T,2,std::vector<uint8_t,std::allocator<uint8_t>>>(const T &,Container &)' being compiled
        with
        [
            T=symusic::Foo4,
            Container=std::vector<uint8_t,std::allocator<uint8_t>>
        ]
C:\Users\nhy\symusic-libra\3rdparty\alpaca\include\alpaca/alpaca.h(152): note: see reference to function template instantiation 'void alpaca::detail::serialize_helper<alpaca::options::none,T,2,std::vector<uint8_t,std::allocator<uint8_t>>,0>(const T &,Container &,size_t &)' being compiled
        with
        [
            T=symusic::Foo4,
            Container=std::vector<uint8_t,std::allocator<uint8_t>>
        ]
C:\Users\nhy\symusic-libra\3rdparty\alpaca\include\alpaca/alpaca.h(135): note: see reference to function template instantiation 'decltype(auto) alpaca::detail::get<0,const T&,2>(type) noexcept' being compiled
        with
        [
            T=symusic::Foo4,
            type=const symusic::Foo4 &
        ]
ninja: build stopped: subcommand failed.

Note that I'm using c++20 and msvc 19.38.33133.0 on windows11. And I have read the similar issue #24

Is this library still maintained?

The commit history seems to indicate that the library is not even more maintainedo does it works almost perfectly and additional features are not developed anymore?

[Question] Update release version

What do you think about creating new release version? The last one was at the september of 2022.

New release version is needed to update version on conan

Serializing unsupported types

Thanks for this awesome libs.

My question is how can I serialize custom types? My struct is using absl::int128 (abseil) and I want to be able to serialize it.
Is there a way to specialize the function that does the serialization for adding unsupported one? Just like nlohmann::json does

Needs to embed a fake struct to serialize direct STL types

This works:
constexpr auto OPTIONS = alpaca::options::with_checksum | alpaca::options::fixed_length_encoding; using serialize_t = std::map<int,bool>; auto Serialize(const serialize_t& to_serialize) { std::vector<uint8_t> buffer; struct MyStruct { serialize_t field; }; const MyStruct& object{to_serialize}; if(auto bytes_written=alpaca::serialize<OPTIONS>(object,buffer)) return std::make_pair(buffer,true); else return std::make_pair(buffer,false); };

This does not:

constexpr auto OPTIONS = alpaca::options::with_checksum | alpaca::options::fixed_length_encoding; using serialize_t = std::map<int,bool>; auto Serialize(const serialize_t& to_serialize) { std::vector<uint8_t> buffer; if(auto bytes_written=alpaca::serialize<OPTIONS>(to_serialize,buffer)) return std::make_pair(buffer,true); else return std::make_pair(buffer,false); };

Would be great to be able to use it without using MyStruct.

Linker error with std::filesystem::path

Hello, I am trying to serialize a class with std::filesystem::path data members.

I am getting the following linker error :

/usr/bin/ld: mylib.so: undefined reference to `std::enable_if<(!(std::is_aggregate_v<std::filesystem::__cxx11::path>))&&(std::is_class_v<std::filesystem::__cxx11::path>), void>::type alpaca::detail::to_bytes<(alpaca::options)8, std::vector<unsigned char, std::allocator<unsigned char> >, std::filesystem::__cxx11::path>(std::vector<unsigned char, std::allocator<unsigned char> >&, unsigned long&, std::filesystem::__cxx11::path const&)'

Since alpaca is header-only and heavily using templates, I don't really understand why I can have an undefined reference error.
I would expect compilation errors if the template cannot be instanciated, but then if the template can be instanciated I should not have linker errors ?

How can I resolve this error ?

(De)serialize from C-style pointer without copy

It is not always possible to use std::vector, std::array, or c_array[] style types. Right now, deserialization from raw pointer (uint8_t*) requires a copy.

example:

MyStruct raw_pointer_deserialize(const uint8_t* ptr) {
  std::error_code ec;
  return deserialize<MyStruct>((const uint8_t*)ptr, sizeof(MyStruct), ec);
}

A version of from_bytes with std::is_pointer on the container and runtime size passed in may be all that is needed.

Problem serializing std::tuple

I am not able to get tuples to serialize using g++ 11.3.0 on ubuntu 22.04.

Here's my program

#include <alpaca/alpaca.h>
#include <tuple>
std::tuple<int, double> t(1, 2.3);

std::vector<uint8_t> bytes;
auto bytes_written = alpaca::serialize(t, bytes); 

which fails to compile as follows

g++ -std=c++17 -I../build/_deps/alpaca-src/include/ test_alpaca.cpp 
In file included from ../build/_deps/alpaca-src/include/alpaca/alpaca.h:9,
                 from test_alpaca.cpp:1:
../build/_deps/alpaca-src/include/alpaca/detail/struct_nth_field.h: In instantiation of ‘constexpr decltype(auto) alpaca::detail::get(type&) [with long unsigned int index = 0; type = const std::tuple<int, double>&; long unsigned int arity = 4]’:
../build/_deps/alpaca-src/include/alpaca/alpaca.h:139:60:   required from ‘void alpaca::detail::serialize_helper(const T&, Container&, std::size_t&) [with alpaca::options O = alpaca::options::none; T = std::tuple<int, double>; long unsigned int N = 4; Container = std::vector<unsigned char>; long unsigned int I = 0; std::size_t = long unsigned int]’
../build/_deps/alpaca-src/include/alpaca/alpaca.h:156:62:   required from ‘std::size_t alpaca::serialize(const T&, Container&) [with T = std::tuple<int, double>; long unsigned int N = 4; Container = std::vector<unsigned char>; std::size_t = long unsigned int]’
test_alpaca.cpp:8:39:   required from here
../build/_deps/alpaca-src/include/alpaca/detail/struct_nth_field.h:41:11: error: 4 names provided for structured binding
   41 |     auto &[p1, p2, p3, p4] = value;
      |           ^~~~~~~~~~~~~~~~
../build/_deps/alpaca-src/include/alpaca/detail/struct_nth_field.h:41:11: note: while ‘const std::tuple<int, double>’ decomposes into 2 elements

Any thoughts appreciated.
Thanks,
Mike

Docs: Add example of own type serealization

Unfortunately, not all types are supported by this library. The one example is glm vectors. So it would be useful to have guide how to add own types.

@p-ranav, If you don't mind, I will be able to add serealization of glm vector as an example

Bitfield support

As far as I can make out with my tests there is no support for bitfield struct serialization in Alpaca. Is there any way to achieve this, and give a standardized method to implement it for a large number of structs.

cross-compilation for embedded bare-metal environment

Hi @p-ranav ,

Would you be able to provide a list of instructions for cross-compiling to bare metal platform?

I'm using the following toolchain:

GNU Arm Embedded Toolchain 2021.07
Pre-built GNU toolchain for Arm Cortex-A/R and Cortex-M processors
GCC Version: 10.3

With this toolchain I get the following error:

./include/alpaca/detail/crc32.hpp:73:2: error: #error unsupported system 73 | #error unsupported system

Thanks!

Big-endian support?

I'm not sure if I'm reading the code correctly, but it seems like alpaca always reads data in little-endian order, and sets members assuming the target system is little endian. Is alpaca endian-agnostic or does it only support little-endian?

Integer value problem

I copyed the sample code and just change the value of c to UINT64_MAX, the assert failed.

#include <alpaca/alpaca.h>

int main() {

    struct MyStruct {
        char a;
        int b;
        uint64_t c;
        float d;
        bool e;
    };

    MyStruct s{ 'a', 5, UINT64_MAX, 3.14f, true };

    // Serialize
    std::vector<uint8_t> bytes;
    auto bytes_written = alpaca::serialize(s, bytes);

    // Deserialize
    std::error_code ec;
    auto recovered = alpaca::deserialize<MyStruct>(bytes, ec);
    assert((bool)ec == false);
    assert(recovered.a == 'a');
    assert(recovered.b == 5);
    assert(recovered.c == UINT64_MAX);
    assert(recovered.d == 3.14f);
    assert(recovered.e == true);
}

Is this a problem? My test environment is msvc2022.
I also tested the same code in Ubuntu 20.04.4 LTS and g++ version 9.4.0 , same result.

Variable length encoding fails the simpler test

The source code is quite self-explaining.
The code is properly working if the fixed-length econding is enable.
Linux - GCC v 14.1.1 - Current master branch.
Really scaring.

#include "alpaca/alpaca.h"

struct Simple {
    uint32_t field {0};
};

int main() {
    Simple data {0x12345678};

    std::vector<uint8_t> bytes;
    auto size = alpaca::serialize(data, bytes);

    std::error_code err;
    auto reconstructed = alpaca::deserialize<Simple>(bytes, err);

    assert(!err);
    
    assert(reconstructed.field == data.field); // And here it dies.
}

samples/optional_values.cpp: compile error: no matching function for call to 'to_bytes'

I wanted to give this a try, downloaded and failed to compile 😞 :
(MacBook Pro M2, macOS Sonoma)

$ cmake -DALPACA_BUILD_TESTS=on       -DALPACA_BUILD_BENCHMARKS=on       -DALPACA_BUILD_SAMPLES=on     -DCMAKE_BUILD_TYPE=Release ..
-- The CXX compiler identification is AppleClang 15.0.0.15000100
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/usr/bin/g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The C compiler identification is AppleClang 15.0.0.15000100
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/usr/bin/gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Building benchmark
-- Could NOT find benchmark (missing: benchmark_DIR)
-- Using CMake Version 3.24.4
-- Downloading GoogleBenchmark
-- Found Git: /usr/bin/git (found version "2.39.3 (Apple Git-145)") 
-- git Version: v1.5.2
-- Version: 1.5.2
-- Performing Test HAVE_CXX_FLAG_STD_CXX11
-- Performing Test HAVE_CXX_FLAG_STD_CXX11 - Success
-- Performing Test HAVE_CXX_FLAG_WALL
-- Performing Test HAVE_CXX_FLAG_WALL - Success
-- Performing Test HAVE_CXX_FLAG_WEXTRA
-- Performing Test HAVE_CXX_FLAG_WEXTRA - Success
-- Performing Test HAVE_CXX_FLAG_WSHADOW
-- Performing Test HAVE_CXX_FLAG_WSHADOW - Success
-- Performing Test HAVE_CXX_FLAG_WERROR
-- Performing Test HAVE_CXX_FLAG_WERROR - Success
-- Performing Test HAVE_CXX_FLAG_WSHORTEN_64_TO_32
-- Performing Test HAVE_CXX_FLAG_WSHORTEN_64_TO_32 - Success
-- Performing Test HAVE_CXX_FLAG_FSTRICT_ALIASING
-- Performing Test HAVE_CXX_FLAG_FSTRICT_ALIASING - Success
-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED_DECLARATIONS
-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED_DECLARATIONS - Success
-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED
-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED - Success
-- Performing Test HAVE_CXX_FLAG_WSTRICT_ALIASING
-- Performing Test HAVE_CXX_FLAG_WSTRICT_ALIASING - Success
-- Performing Test HAVE_CXX_FLAG_WD654
-- Performing Test HAVE_CXX_FLAG_WD654 - Failed
-- Performing Test HAVE_CXX_FLAG_WTHREAD_SAFETY
-- Performing Test HAVE_CXX_FLAG_WTHREAD_SAFETY - Success
-- Performing Test HAVE_THREAD_SAFETY_ATTRIBUTES
-- Performing Test HAVE_THREAD_SAFETY_ATTRIBUTES
-- Performing Test HAVE_THREAD_SAFETY_ATTRIBUTES -- failed to compile
-- Performing Test HAVE_CXX_FLAG_COVERAGE
-- Performing Test HAVE_CXX_FLAG_COVERAGE - Success
-- Performing Test HAVE_STD_REGEX
-- Performing Test HAVE_STD_REGEX
-- Performing Test HAVE_STD_REGEX -- success
-- Performing Test HAVE_GNU_POSIX_REGEX
-- Performing Test HAVE_GNU_POSIX_REGEX
-- Performing Test HAVE_GNU_POSIX_REGEX -- failed to compile
-- Performing Test HAVE_POSIX_REGEX
-- Performing Test HAVE_POSIX_REGEX
-- Performing Test HAVE_POSIX_REGEX -- success
-- Performing Test HAVE_STEADY_CLOCK
-- Performing Test HAVE_STEADY_CLOCK
-- Performing Test HAVE_STEADY_CLOCK -- success
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Performing Test BENCHMARK_HAS_O3_FLAG
-- Performing Test BENCHMARK_HAS_O3_FLAG - Success
-- Performing Test BENCHMARK_HAS_CXX03_FLAG
-- Performing Test BENCHMARK_HAS_CXX03_FLAG - Success
-- Performing Test BENCHMARK_HAS_WNO_ODR
-- Performing Test BENCHMARK_HAS_WNO_ODR - Success
-- Configuring done
-- Generating done
-- Build files have been written to:alpaca/build
$ make
[  0%] Building CXX object test/CMakeFiles/ALPACA.dir/main.cpp.o
In file included from /Users/Mladen/Developer/C++/ngfsw/alpaca/test/main.cpp:1:
/Users/Mladen/Developer/C++/ngfsw/alpaca/test/./doctest.hpp:3725:1: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
DOCTEST_TO_STRING_OVERLOAD(char, "%d")
^
/Users/Mladen/Developer/C++/ngfsw/alpaca/test/./doctest.hpp:3721:14: note: expanded from macro 'DOCTEST_TO_STRING_OVERLOAD'
        std::sprintf(buf, fmt, in);                                                                \
             ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/stdio.h:180:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
In file included from /Users/Mladen/Developer/C++/ngfsw/alpaca/test/main.cpp:1:
/Users/Mladen/Developer/C++/ngfsw/alpaca/test/./doctest.hpp:3726:1: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
DOCTEST_TO_STRING_OVERLOAD(char signed, "%d")
^
/Users/Mladen/Developer/C++/ngfsw/alpaca/test/./doctest.hpp:3721:14: note: expanded from macro 'DOCTEST_TO_STRING_OVERLOAD'
        std::sprintf(buf, fmt, in);                                                                \
             ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/stdio.h:180:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
In file included from /Users/Mladen/Developer/C++/ngfsw/alpaca/test/main.cpp:1:
/Users/Mladen/Developer/C++/ngfsw/alpaca/test/./doctest.hpp:3727:1: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
DOCTEST_TO_STRING_OVERLOAD(char unsigned, "%u")
^
/Users/Mladen/Developer/C++/ngfsw/alpaca/test/./doctest.hpp:3721:14: note: expanded from macro 'DOCTEST_TO_STRING_OVERLOAD'
        std::sprintf(buf, fmt, in);                                                                \
             ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/stdio.h:180:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
In file included from /Users/Mladen/Developer/C++/ngfsw/alpaca/test/main.cpp:1:
/Users/Mladen/Developer/C++/ngfsw/alpaca/test/./doctest.hpp:3728:1: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
DOCTEST_TO_STRING_OVERLOAD(int short, "%d")
^
/Users/Mladen/Developer/C++/ngfsw/alpaca/test/./doctest.hpp:3721:14: note: expanded from macro 'DOCTEST_TO_STRING_OVERLOAD'
        std::sprintf(buf, fmt, in);                                                                \
             ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/stdio.h:180:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
In file included from /Users/Mladen/Developer/C++/ngfsw/alpaca/test/main.cpp:1:
/Users/Mladen/Developer/C++/ngfsw/alpaca/test/./doctest.hpp:3729:1: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
DOCTEST_TO_STRING_OVERLOAD(int short unsigned, "%u")
^
/Users/Mladen/Developer/C++/ngfsw/alpaca/test/./doctest.hpp:3721:14: note: expanded from macro 'DOCTEST_TO_STRING_OVERLOAD'
        std::sprintf(buf, fmt, in);                                                                \
             ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/stdio.h:180:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
In file included from /Users/Mladen/Developer/C++/ngfsw/alpaca/test/main.cpp:1:
/Users/Mladen/Developer/C++/ngfsw/alpaca/test/./doctest.hpp:3730:1: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
DOCTEST_TO_STRING_OVERLOAD(int, "%d")
^
/Users/Mladen/Developer/C++/ngfsw/alpaca/test/./doctest.hpp:3721:14: note: expanded from macro 'DOCTEST_TO_STRING_OVERLOAD'
        std::sprintf(buf, fmt, in);                                                                \
             ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/stdio.h:180:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
In file included from /Users/Mladen/Developer/C++/ngfsw/alpaca/test/main.cpp:1:
/Users/Mladen/Developer/C++/ngfsw/alpaca/test/./doctest.hpp:3731:1: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
DOCTEST_TO_STRING_OVERLOAD(unsigned, "%u")
^
/Users/Mladen/Developer/C++/ngfsw/alpaca/test/./doctest.hpp:3721:14: note: expanded from macro 'DOCTEST_TO_STRING_OVERLOAD'
        std::sprintf(buf, fmt, in);                                                                \
             ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/stdio.h:180:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
In file included from /Users/Mladen/Developer/C++/ngfsw/alpaca/test/main.cpp:1:
/Users/Mladen/Developer/C++/ngfsw/alpaca/test/./doctest.hpp:3732:1: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
DOCTEST_TO_STRING_OVERLOAD(int long, "%ld")
^
/Users/Mladen/Developer/C++/ngfsw/alpaca/test/./doctest.hpp:3721:14: note: expanded from macro 'DOCTEST_TO_STRING_OVERLOAD'
        std::sprintf(buf, fmt, in);                                                                \
             ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/stdio.h:180:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
In file included from /Users/Mladen/Developer/C++/ngfsw/alpaca/test/main.cpp:1:
/Users/Mladen/Developer/C++/ngfsw/alpaca/test/./doctest.hpp:3733:1: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
DOCTEST_TO_STRING_OVERLOAD(int long unsigned, "%lu")
^
/Users/Mladen/Developer/C++/ngfsw/alpaca/test/./doctest.hpp:3721:14: note: expanded from macro 'DOCTEST_TO_STRING_OVERLOAD'
        std::sprintf(buf, fmt, in);                                                                \
             ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/stdio.h:180:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
In file included from /Users/Mladen/Developer/C++/ngfsw/alpaca/test/main.cpp:1:
/Users/Mladen/Developer/C++/ngfsw/alpaca/test/./doctest.hpp:3734:1: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
DOCTEST_TO_STRING_OVERLOAD(int long long, "%lld")
^
/Users/Mladen/Developer/C++/ngfsw/alpaca/test/./doctest.hpp:3721:14: note: expanded from macro 'DOCTEST_TO_STRING_OVERLOAD'
        std::sprintf(buf, fmt, in);                                                                \
             ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/stdio.h:180:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
In file included from /Users/Mladen/Developer/C++/ngfsw/alpaca/test/main.cpp:1:
/Users/Mladen/Developer/C++/ngfsw/alpaca/test/./doctest.hpp:3735:1: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
DOCTEST_TO_STRING_OVERLOAD(int long long unsigned, "%llu")
^
/Users/Mladen/Developer/C++/ngfsw/alpaca/test/./doctest.hpp:3721:14: note: expanded from macro 'DOCTEST_TO_STRING_OVERLOAD'
        std::sprintf(buf, fmt, in);                                                                \
             ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/stdio.h:180:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
11 warnings generated.
[  0%] Building CXX object test/CMakeFiles/ALPACA.dir/test_backwards_compatibility.cpp.o
[  1%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_array.cpp.o
[  1%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_big_endian.cpp.o
[  2%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_bool.cpp.o
[  2%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_bool_from_array.cpp.o
[  3%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_chrono_duration.cpp.o
[  3%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_chrono_duration_from_array.cpp.o
[  4%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_deque.cpp.o
[  4%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_deque_from_array.cpp.o
[  5%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_enum_class.cpp.o
[  5%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_enum_class_from_array.cpp.o
[  6%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_error_crc32.cpp.o
[  6%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_error_crc32_from_array.cpp.o
[  7%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_error_set.cpp.o
[  7%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_error_set_from_array.cpp.o
[  8%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_error_vector.cpp.o
[  8%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_error_vector_from_array.cpp.o
[  9%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_error_version.cpp.o
[  9%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_error_version_from_array.cpp.o
[ 10%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_float.cpp.o
[ 10%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_float_from_array.cpp.o
[ 11%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_from_carray.cpp.o
[ 11%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_from_ifstream.cpp.o
[ 12%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_int.cpp.o
[ 12%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_int_from_array.cpp.o
[ 13%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_list.cpp.o
[ 13%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_list_from_array.cpp.o
[ 14%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_map.cpp.o
[ 14%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_map_from_array.cpp.o
[ 15%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_optional.cpp.o
[ 15%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_optional_from_array.cpp.o
[ 16%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_pair.cpp.o
[ 16%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_pair_from_array.cpp.o
[ 16%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_set.cpp.o
[ 17%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_set_from_array.cpp.o
[ 17%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_string.cpp.o
[ 18%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_string_from_array.cpp.o
[ 18%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_tuple.cpp.o
[ 19%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_tuple_from_array.cpp.o
[ 19%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_uint.cpp.o
[ 20%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_uint_from_array.cpp.o
[ 20%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_unique_ptr.cpp.o
[ 21%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_unique_ptr_from_array.cpp.o
[ 21%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_ustring.cpp.o
[ 22%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_variant.cpp.o
[ 22%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_variant_from_array.cpp.o
[ 23%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_vector.cpp.o
[ 23%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_vector_from_array.cpp.o
[ 24%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_with_crc32.cpp.o
[ 24%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_with_crc32_from_array.cpp.o
[ 25%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_with_version.cpp.o
[ 25%] Building CXX object test/CMakeFiles/ALPACA.dir/test_deserialize_with_version_from_array.cpp.o
[ 26%] Building CXX object test/CMakeFiles/ALPACA.dir/test_forwards_compatibility.cpp.o
[ 26%] Building CXX object test/CMakeFiles/ALPACA.dir/test_forwards_compatibility_from_array.cpp.o
[ 27%] Building CXX object test/CMakeFiles/ALPACA.dir/test_serialize_array.cpp.o
[ 27%] Building CXX object test/CMakeFiles/ALPACA.dir/test_serialize_array_into_array.cpp.o
[ 28%] Building CXX object test/CMakeFiles/ALPACA.dir/test_serialize_big_endian.cpp.o
[ 28%] Building CXX object test/CMakeFiles/ALPACA.dir/test_serialize_big_endian_into_array.cpp.o
[ 29%] Building CXX object test/CMakeFiles/ALPACA.dir/test_serialize_bool.cpp.o
[ 29%] Building CXX object test/CMakeFiles/ALPACA.dir/test_serialize_bool_into_array.cpp.o
[ 30%] Building CXX object test/CMakeFiles/ALPACA.dir/test_serialize_chrono_duration.cpp.o
[ 30%] Building CXX object test/CMakeFiles/ALPACA.dir/test_serialize_chrono_duration_to_array.cpp.o
[ 31%] Building CXX object test/CMakeFiles/ALPACA.dir/test_serialize_deque.cpp.o
[ 31%] Building CXX object test/CMakeFiles/ALPACA.dir/test_serialize_deque_into_array.cpp.o
[ 32%] Building CXX object test/CMakeFiles/ALPACA.dir/test_serialize_enum_class.cpp.o
[ 32%] Building CXX object test/CMakeFiles/ALPACA.dir/test_serialize_enum_class_into_array.cpp.o
[ 33%] Building CXX object test/CMakeFiles/ALPACA.dir/test_serialize_float.cpp.o
[ 33%] Building CXX object test/CMakeFiles/ALPACA.dir/test_serialize_float_into_array.cpp.o
[ 33%] Building CXX object test/CMakeFiles/ALPACA.dir/test_serialize_int.cpp.o
[ 34%] Building CXX object test/CMakeFiles/ALPACA.dir/test_serialize_int_into_array.cpp.o
[ 34%] Building CXX object test/CMakeFiles/ALPACA.dir/test_serialize_into_carray.cpp.o
[ 35%] Building CXX object test/CMakeFiles/ALPACA.dir/test_serialize_list.cpp.o
[ 35%] Building CXX object test/CMakeFiles/ALPACA.dir/test_serialize_list_into_array.cpp.o
[ 36%] Building CXX object test/CMakeFiles/ALPACA.dir/test_serialize_map.cpp.o
[ 36%] Building CXX object test/CMakeFiles/ALPACA.dir/test_serialize_map_into_array.cpp.o
[ 37%] Building CXX object test/CMakeFiles/ALPACA.dir/test_serialize_nested_struct.cpp.o
[ 37%] Building CXX object test/CMakeFiles/ALPACA.dir/test_serialize_nested_struct_into_array.cpp.o
[ 38%] Building CXX object test/CMakeFiles/ALPACA.dir/test_serialize_optional.cpp.o
[ 38%] Building CXX object test/CMakeFiles/ALPACA.dir/test_serialize_optional_into_array.cpp.o
[ 39%] Building CXX object test/CMakeFiles/ALPACA.dir/test_serialize_pair.cpp.o
[ 39%] Building CXX object test/CMakeFiles/ALPACA.dir/test_serialize_pair_optional.cpp.o
[ 40%] Building CXX object test/CMakeFiles/ALPACA.dir/test_serialize_set.cpp.o
[ 40%] Building CXX object test/CMakeFiles/ALPACA.dir/test_serialize_set_into_array.cpp.o
[ 41%] Building CXX object test/CMakeFiles/ALPACA.dir/test_serialize_string.cpp.o
[ 41%] Building CXX object test/CMakeFiles/ALPACA.dir/test_serialize_string_into_array.cpp.o
[ 42%] Building CXX object test/CMakeFiles/ALPACA.dir/test_serialize_to_fstream.cpp.o
[ 42%] Building CXX object test/CMakeFiles/ALPACA.dir/test_serialize_tuple.cpp.o
[ 43%] Building CXX object test/CMakeFiles/ALPACA.dir/test_serialize_tuple_into_array.cpp.o
[ 43%] Building CXX object test/CMakeFiles/ALPACA.dir/test_serialize_uint.cpp.o
[ 44%] Building CXX object test/CMakeFiles/ALPACA.dir/test_serialize_uint_into_array.cpp.o
[ 44%] Building CXX object test/CMakeFiles/ALPACA.dir/test_serialize_unique_ptr.cpp.o
[ 45%] Building CXX object test/CMakeFiles/ALPACA.dir/test_serialize_unique_ptr_into_array.cpp.o
[ 45%] Building CXX object test/CMakeFiles/ALPACA.dir/test_serialize_variant.cpp.o
[ 46%] Building CXX object test/CMakeFiles/ALPACA.dir/test_serialize_variant_into_array.cpp.o
[ 46%] Building CXX object test/CMakeFiles/ALPACA.dir/test_serialize_vector.cpp.o
[ 47%] Building CXX object test/CMakeFiles/ALPACA.dir/test_serialize_vector_into_array.cpp.o
[ 47%] Building CXX object test/CMakeFiles/ALPACA.dir/test_serialize_with_crc32.cpp.o
[ 48%] Building CXX object test/CMakeFiles/ALPACA.dir/test_serialize_with_crc32_into_array.cpp.o
[ 48%] Building CXX object test/CMakeFiles/ALPACA.dir/test_type_info.cpp.o
[ 49%] Linking CXX executable tests
[ 49%] Built target ALPACA
[ 50%] Building CXX object samples/CMakeFiles/fundamental_types.dir/fundamental_types.cpp.o
[ 50%] Linking CXX executable fundamental_types
[ 50%] Built target fundamental_types
[ 50%] Building CXX object samples/CMakeFiles/arrays_vectors_strings.dir/arrays_vectors_strings.cpp.o
[ 50%] Linking CXX executable arrays_vectors_strings
[ 50%] Built target arrays_vectors_strings
[ 51%] Building CXX object samples/CMakeFiles/maps_and_sets.dir/maps_and_sets.cpp.o
[ 51%] Linking CXX executable maps_and_sets
[ 51%] Built target maps_and_sets
[ 51%] Building CXX object samples/CMakeFiles/nested_structures.dir/nested_structures.cpp.o
[ 52%] Linking CXX executable nested_structures
[ 52%] Built target nested_structures
[ 52%] Building CXX object samples/CMakeFiles/optional_values.dir/optional_values.cpp.o
In file included from /Users/Mladen/Developer/C++/ngfsw/alpaca/samples/optional_values.cpp:1:
/Users/Mladen/Developer/C++/ngfsw/alpaca/include/alpaca/alpaca.h:125:3: error: no matching function for call to 'to_bytes'
  to_bytes<O>(bytes, byte_index, input);
  ^~~~~~~~~~~
/Users/Mladen/Developer/C++/ngfsw/alpaca/include/alpaca/detail/types/vector.h:34:5: note: in instantiation of function template specialization 'alpaca::detail::to_bytes_router<alpaca::options::none, std::__bit_const_reference<std::vector<bool>>, std::vector<unsigned char>>' requested here
    to_bytes_router<O>(v, bytes, byte_index);
    ^
/Users/Mladen/Developer/C++/ngfsw/alpaca/include/alpaca/detail/types/vector.h:48:3: note: in instantiation of function template specialization 'alpaca::detail::to_bytes_from_vector_type<alpaca::options::none, std::vector<bool>, std::vector<unsigned char>>' requested here
  to_bytes_from_vector_type<O, std::vector<bool>, Container>(input, bytes,
  ^
/Users/Mladen/Developer/C++/ngfsw/alpaca/include/alpaca/alpaca.h:125:3: note: in instantiation of function template specialization 'alpaca::detail::to_bytes<alpaca::options::none, std::vector<unsigned char>>' requested here
  to_bytes<O>(bytes, byte_index, input);
  ^
/Users/Mladen/Developer/C++/ngfsw/alpaca/include/alpaca/detail/types/optional.h:35:5: note: in instantiation of function template specialization 'alpaca::detail::to_bytes_router<alpaca::options::none, std::vector<bool>, std::vector<unsigned char>>' requested here
    to_bytes_router<O, U>(input.value(), bytes, byte_index);
    ^
/Users/Mladen/Developer/C++/ngfsw/alpaca/include/alpaca/alpaca.h:125:3: note: in instantiation of function template specialization 'alpaca::detail::to_bytes<alpaca::options::none, std::vector<unsigned char>, std::vector<bool>>' requested here
  to_bytes<O>(bytes, byte_index, input);
  ^
/Users/Mladen/Developer/C++/ngfsw/alpaca/include/alpaca/alpaca.h:138:13: note: (skipping 1 context in backtrace; use -ftemplate-backtrace-limit=0 to see all)
    detail::to_bytes_router<O>(field, bytes, byte_index);
            ^
/Users/Mladen/Developer/C++/ngfsw/alpaca/include/alpaca/alpaca.h:141:5: note: in instantiation of function template specialization 'alpaca::detail::serialize_helper<alpaca::options::none, MyStruct, 4UL, std::vector<unsigned char>, 3UL>' requested here
    serialize_helper<O, T, N, Container, I + 1>(s, bytes, byte_index);
    ^
/Users/Mladen/Developer/C++/ngfsw/alpaca/include/alpaca/alpaca.h:141:5: note: in instantiation of function template specialization 'alpaca::detail::serialize_helper<alpaca::options::none, MyStruct, 4UL, std::vector<unsigned char>, 2UL>' requested here
/Users/Mladen/Developer/C++/ngfsw/alpaca/include/alpaca/alpaca.h:141:5: note: in instantiation of function template specialization 'alpaca::detail::serialize_helper<alpaca::options::none, MyStruct, 4UL, std::vector<unsigned char>, 1UL>' requested here
/Users/Mladen/Developer/C++/ngfsw/alpaca/include/alpaca/alpaca.h:152:11: note: in instantiation of function template specialization 'alpaca::detail::serialize_helper<alpaca::options::none, MyStruct, 4UL, std::vector<unsigned char>, 0UL>' requested here
  detail::serialize_helper<options::none, T, N, Container, 0>(s, bytes,
          ^
/Users/Mladen/Developer/C++/ngfsw/alpaca/samples/optional_values.cpp:17:32: note: in instantiation of function template specialization 'alpaca::serialize<MyStruct, 4UL, std::vector<unsigned char>>' requested here
  auto bytes_written = alpaca::serialize<MyStruct, 4>(
                               ^
/Users/Mladen/Developer/C++/ngfsw/alpaca/include/alpaca/detail/types/filesystem_path.h:26:6: note: candidate function template not viable: no known conversion from 'const std::__bit_const_reference<std::vector<bool>>' to 'const std::filesystem::path' for 3rd argument
void to_bytes(Container &bytes, std::size_t &byte_index,
     ^
/Users/Mladen/Developer/C++/ngfsw/alpaca/include/alpaca/detail/types/vector.h:46:6: note: candidate function template not viable: no known conversion from 'const std::__bit_const_reference<std::vector<bool>>' to 'const std::vector<bool>' for 3rd argument
void to_bytes(Container &bytes, std::size_t &byte_index,
     ^
/Users/Mladen/Developer/C++/ngfsw/alpaca/include/alpaca/detail/to_bytes.h:39:1: note: candidate template ignored: requirement 'std::is_same_v<std::__bit_const_reference<std::vector<bool, std::allocator<bool>>>, bool> || std::is_same_v<std::__bit_const_reference<std::vector<bool, std::allocator<bool>>>, char> || std::is_same_v<std::__bit_const_reference<std::vector<bool, std::allocator<bool>>>, wchar_t> || std::is_same_v<std::__bit_const_reference<std::vector<bool, std::allocator<bool>>>, char16_t> || std::is_same_v<std::__bit_const_reference<std::vector<bool, std::allocator<bool>>>, char32_t> || std::is_same_v<std::__bit_const_reference<std::vector<bool, std::allocator<bool>>>, unsigned char> || std::is_same_v<std::__bit_const_reference<std::vector<bool, std::allocator<bool>>>, unsigned short> || std::is_same_v<std::__bit_const_reference<std::vector<bool, std::allocator<bool>>>, signed char> || std::is_same_v<std::__bit_const_reference<std::vector<bool, std::allocator<bool>>>, short> || std::is_same_v<std::__bit_const_reference<std::vector<bool, std::allocator<bool>>>, float> || std::is_same_v<std::__bit_const_reference<std::vector<bool, std::allocator<bool>>>, double>' was not satisfied [with O = alpaca::options::none, T = std::vector<unsigned char>, U = std::__bit_const_reference<std::vector<bool>>]
to_bytes(T &bytes, std::size_t &byte_index, const U &original_value) {
^
/Users/Mladen/Developer/C++/ngfsw/alpaca/include/alpaca/detail/to_bytes.h:54:1: note: candidate template ignored: requirement 'std::is_same_v<std::__bit_const_reference<std::vector<bool, std::allocator<bool>>>, unsigned int> || std::is_same_v<std::__bit_const_reference<std::vector<bool, std::allocator<bool>>>, unsigned long long> || std::is_same_v<std::__bit_const_reference<std::vector<bool, std::allocator<bool>>>, int> || std::is_same_v<std::__bit_const_reference<std::vector<bool, std::allocator<bool>>>, long long> || std::is_same_v<std::__bit_const_reference<std::vector<bool, std::allocator<bool>>>, unsigned long>' was not satisfied [with O = alpaca::options::none, T = std::vector<unsigned char>, U = std::__bit_const_reference<std::vector<bool>>]
to_bytes(T &bytes, std::size_t &byte_index, const U &original_value) {
^
/Users/Mladen/Developer/C++/ngfsw/alpaca/include/alpaca/detail/to_bytes.h:79:1: note: candidate template ignored: requirement 'std::is_enum<std::__bit_const_reference<std::vector<bool, std::allocator<bool>>>>::value' was not satisfied [with O = alpaca::options::none, T = std::vector<unsigned char>, U = std::__bit_const_reference<std::vector<bool>>]
to_bytes(T &bytes, std::size_t &byte_index, const U &value) {
^
/Users/Mladen/Developer/C++/ngfsw/alpaca/include/alpaca/alpaca.h:117:1: note: candidate template ignored: requirement 'std::is_aggregate_v<std::__bit_const_reference<std::vector<bool, std::allocator<bool>>>>' was not satisfied [with O = alpaca::options::none, T = std::vector<unsigned char>, U = std::__bit_const_reference<std::vector<bool>>]
to_bytes(T &bytes, std::size_t &byte_index, const U &input) {
^
/Users/Mladen/Developer/C++/ngfsw/alpaca/include/alpaca/detail/types/array.h:26:6: note: candidate template ignored: could not match 'array' against '__bit_const_reference'
void to_bytes(Container &bytes, std::size_t &byte_index,
     ^
/Users/Mladen/Developer/C++/ngfsw/alpaca/include/alpaca/detail/types/deque.h:39:6: note: candidate template ignored: could not match 'deque' against '__bit_const_reference'
void to_bytes(Container &bytes, std::size_t &byte_index,
     ^
/Users/Mladen/Developer/C++/ngfsw/alpaca/include/alpaca/detail/types/duration.h:30:6: note: candidate template ignored: could not match 'duration' against '__bit_const_reference'
void to_bytes(Container &bytes, std::size_t &byte_index,
     ^
/Users/Mladen/Developer/C++/ngfsw/alpaca/include/alpaca/detail/types/list.h:39:6: note: candidate template ignored: could not match 'list' against '__bit_const_reference'
void to_bytes(Container &bytes, std::size_t &byte_index,
     ^
/Users/Mladen/Developer/C++/ngfsw/alpaca/include/alpaca/detail/types/map.h:65:6: note: candidate template ignored: could not match 'map' against '__bit_const_reference'
void to_bytes(Container &bytes, std::size_t &byte_index,
     ^
/Users/Mladen/Developer/C++/ngfsw/alpaca/include/alpaca/detail/types/map.h:73:6: note: candidate template ignored: could not match 'unordered_map' against '__bit_const_reference'
void to_bytes(Container &bytes, std::size_t &byte_index,
     ^
/Users/Mladen/Developer/C++/ngfsw/alpaca/include/alpaca/detail/types/optional.h:26:6: note: candidate template ignored: could not match 'optional' against '__bit_const_reference'
void to_bytes(Container &bytes, std::size_t &byte_index,
     ^
/Users/Mladen/Developer/C++/ngfsw/alpaca/include/alpaca/detail/types/pair.h:30:6: note: candidate template ignored: could not match 'pair' against '__bit_const_reference'
void to_bytes(Container &bytes, std::size_t &byte_index,
     ^
/Users/Mladen/Developer/C++/ngfsw/alpaca/include/alpaca/detail/types/set.h:63:6: note: candidate template ignored: could not match 'set' against '__bit_const_reference'
void to_bytes(Container &bytes, std::size_t &byte_index,
     ^
/Users/Mladen/Developer/C++/ngfsw/alpaca/include/alpaca/detail/types/set.h:71:6: note: candidate template ignored: could not match 'unordered_set' against '__bit_const_reference'
void to_bytes(Container &bytes, std::size_t &byte_index,
     ^
/Users/Mladen/Developer/C++/ngfsw/alpaca/include/alpaca/detail/types/string.h:26:6: note: candidate template ignored: could not match 'basic_string' against '__bit_const_reference'
void to_bytes(Container &bytes, std::size_t &byte_index,
     ^
/Users/Mladen/Developer/C++/ngfsw/alpaca/include/alpaca/detail/types/tuple.h:58:6: note: candidate template ignored: could not match 'tuple' against '__bit_const_reference'
void to_bytes(Container &bytes, std::size_t &byte_index,
     ^
/Users/Mladen/Developer/C++/ngfsw/alpaca/include/alpaca/detail/types/unique_ptr.h:28:6: note: candidate template ignored: could not match 'unique_ptr' against '__bit_const_reference'
void to_bytes(Container &bytes, std::size_t &byte_index,
     ^
/Users/Mladen/Developer/C++/ngfsw/alpaca/include/alpaca/detail/types/variant.h:42:6: note: candidate template ignored: could not match 'variant' against '__bit_const_reference'
void to_bytes(Container &bytes, std::size_t &byte_index,
     ^
/Users/Mladen/Developer/C++/ngfsw/alpaca/include/alpaca/detail/types/vector.h:39:6: note: candidate template ignored: could not match 'vector' against '__bit_const_reference'
void to_bytes(Container &bytes, std::size_t &byte_index,
     ^
1 error generated.
make[2]: *** [samples/CMakeFiles/optional_values.dir/optional_values.cpp.o] Error 1
make[1]: *** [samples/CMakeFiles/optional_values.dir/all] Error 2
make: *** [all] Error 2

I removed samples/optional_values.cpp from CMakeLists and had to do it also for
samples/time_t.cpp. Then I recompiled successfully.

Is there something I missed or simply related to my building host ?

PS: had also to exclude for building benchmarks which failed because of the -Werror flag.

no matching function for call to 'to_bytes'

template<typename F>
void RegisterHandle(std::string Name, F f) {
using FirstArgType = first_arg_t<F>;
using SecondArgType = second_arg_t<F>;

auto fun = [f](TCP_SOCKET* Socket,std::vector<uint8_t>& bytes) -> int {

	auto rep = SecondArgType{};
	rep.ec = static_cast<std::errc>(0);

	auto req = alpaca::deserialize<FirstArgType>(bytes, rep.ec);

	if (static_cast<int>(rep.ec) == 0)
		rep.status = f(req, rep);

	bytes.clear();
	alpaca::serialize(rep, bytes);
	Socket->send(bytes);
	
};

Methods[Name] = fun;

}

The above is sample code

(DE)serialize class objects

Is there any way (samples ?) that this library can be used to serialize and deserialize C++ class objects (as compared to structs) ?

Qualification under older C++ standards

Hi thanks for your effort, I want to try this library but unfortunately I'm using an older C++ standard, so I was asking whether alpaca have been proven to be working with any older C++ standards (C++ 14)?

Serialization does not work between 64 bit and 32 bit architectures

When fixed-length encoding is enabled (which is mandatory to avoid breaking integer serialization as noted in issue #40), the string length and various other types (such as array lengths) are serialized using size_t.

Unfortunately, this results in 8-byte serialization on 64-bit architectures and 4-byte serialization on 32-bit architectures.

If a message is serialized on an x86_64 architecture and then deserialized on a 32-bit architecture (e.g., an ARMv7), the result is completely corrupted because the sizeof(std::size_t) differs between the two platforms.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.