You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
int main()
{
StartPacket startPacket;
std::vector<uint8_t> buffer;
auto size = alpaca::serialize(startPacket, buffer);
return 0;
}
`
and here is the compilation error:
In file included from thirdparty/alpaca/include/alpaca/alpaca.h:9, from serialise.cpp:1: thirdparty/alpaca/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 StartPacket&; long unsigned int arity = 5]’: thirdparty/alpaca/include/alpaca/alpaca.h:137:60: required from ‘void alpaca::detail::serialize_helper(const T&, Container&, std::size_t&) [with alpaca::options O = alpaca::options::none; T = StartPacket; long unsigned int N = 5; Container = std::vector<unsigned char>; long unsigned int I = 0; std::size_t = long unsigned int]’ thirdparty/alpaca/include/alpaca/alpaca.h:169:62: required from ‘std::size_t alpaca::serialize(const T&, Container&) [with T = StartPacket; long unsigned int N = 5; Container = std::vector<unsigned char>; std::size_t = long unsigned int]’ serialise.cpp:13:54: required from here thirdparty/alpaca/include/alpaca/detail/struct_nth_field.h:54:11: error: 5 names provided for structured binding 54 | auto &[p1, p2, p3, p4, p5] = value; | ^~~~~~~~~~~~~~~~~~~~ thirdparty/alpaca/include/alpaca/detail/struct_nth_field.h:54:11: note: while ‘const StartPacket’ decomposes into 2 elements In file included from serialise.cpp:1: thirdparty/alpaca/include/alpaca/alpaca.h: In instantiation of ‘void alpaca::detail::serialize_helper(const T&, Container&, std::size_t&) [with alpaca::options O = alpaca::options::none; T = StartPacket; long unsigned int N = 5; Container = std::vector<unsigned char>; long unsigned int I = 0; std::size_t = long unsigned int]’: thirdparty/alpaca/include/alpaca/alpaca.h:169:62: required from ‘std::size_t alpaca::serialize(const T&, Container&) [with T = StartPacket; long unsigned int N = 5; Container = std::vector<unsigned char>; std::size_t = long unsigned int]’ serialise.cpp:13:54: required from here thirdparty/alpaca/include/alpaca/alpaca.h:137:20: error: ‘void field’ has incomplete type 137 | decltype(auto) field = detail::get<I, decltype(ref), N>(ref); | ^~~~~
This seems like a bug to me. This is with the latest alpaca code via git clone as of 2024-12-28.
The text was updated successfully, but these errors were encountered:
Thank you for your reply. Using std::array instead of old style C arrays is obviously much better. However, I think that something has to change. Either alpaca is changed so that the use of C arrays works (i.e. fix that compilation error), or alpaca documentation needs to say that C arrays are not supported and std::array should be used instead.
Here is the code:
`#include <alpaca/alpaca.h>
struct StartPacket
{
int32_t byteCount;
char magic[4];
};
int main()
{
StartPacket startPacket;
std::vector<uint8_t> buffer;
auto size = alpaca::serialize(startPacket, buffer);
return 0;
}
`
and here is the compilation error:
In file included from thirdparty/alpaca/include/alpaca/alpaca.h:9, from serialise.cpp:1: thirdparty/alpaca/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 StartPacket&; long unsigned int arity = 5]’: thirdparty/alpaca/include/alpaca/alpaca.h:137:60: required from ‘void alpaca::detail::serialize_helper(const T&, Container&, std::size_t&) [with alpaca::options O = alpaca::options::none; T = StartPacket; long unsigned int N = 5; Container = std::vector<unsigned char>; long unsigned int I = 0; std::size_t = long unsigned int]’ thirdparty/alpaca/include/alpaca/alpaca.h:169:62: required from ‘std::size_t alpaca::serialize(const T&, Container&) [with T = StartPacket; long unsigned int N = 5; Container = std::vector<unsigned char>; std::size_t = long unsigned int]’ serialise.cpp:13:54: required from here thirdparty/alpaca/include/alpaca/detail/struct_nth_field.h:54:11: error: 5 names provided for structured binding 54 | auto &[p1, p2, p3, p4, p5] = value; | ^~~~~~~~~~~~~~~~~~~~ thirdparty/alpaca/include/alpaca/detail/struct_nth_field.h:54:11: note: while ‘const StartPacket’ decomposes into 2 elements In file included from serialise.cpp:1: thirdparty/alpaca/include/alpaca/alpaca.h: In instantiation of ‘void alpaca::detail::serialize_helper(const T&, Container&, std::size_t&) [with alpaca::options O = alpaca::options::none; T = StartPacket; long unsigned int N = 5; Container = std::vector<unsigned char>; long unsigned int I = 0; std::size_t = long unsigned int]’: thirdparty/alpaca/include/alpaca/alpaca.h:169:62: required from ‘std::size_t alpaca::serialize(const T&, Container&) [with T = StartPacket; long unsigned int N = 5; Container = std::vector<unsigned char>; std::size_t = long unsigned int]’ serialise.cpp:13:54: required from here thirdparty/alpaca/include/alpaca/alpaca.h:137:20: error: ‘void field’ has incomplete type 137 | decltype(auto) field = detail::get<I, decltype(ref), N>(ref); | ^~~~~
This seems like a bug to me. This is with the latest alpaca code via git clone as of 2024-12-28.
The text was updated successfully, but these errors were encountered: