We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
问题:当struct的第一个字段int32_t test;被注释的情况下,才可以编译通过,否则报错
int32_t test;
/usr/bin/gcc -c -m64 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -std=c++20 -DNDEBUG -o build/.objs/hello/linux/x86_64/release/src/main.cpp.o src/main.cpp error: In file included from /usr/local/include/iguana/pb_reader.hpp:3, from /usr/local/include/ylt/struct_pb/struct_pb_impl.hpp:18, from /usr/local/include/ylt/struct_pb.hpp:17, from src/main.cpp:3: /usr/local/include/iguana/pb_util.hpp: In instantiation of ‘void iguana::detail::append_varint_u32(Writer&, std::index_sequence<_Idx ...>) [with long unsigned int v = 130; Writer = iguana::memory_writer; long unsigned int ...I = {0}; std::index_sequence<_Idx ...> = std::integer_sequence<long unsigned int, 0>]’: /usr/local/include/iguana/pb_util.hpp:206:23: required from ‘void iguana::detail::serialize_varint_u32(Writer&) [with unsigned int v = 130; Writer = iguana::memory_writer]’ /usr/local/include/iguana/pb_writer.hpp:200:30: required from ‘void iguana::detail::to_pb_impl(Type&&, uint32_t*&, Writer&) [with unsigned int key = 130; bool omit_default_val = true; Type = const std::__cxx11::basic_string<char>&; Writer = iguana::memory_writer; uint32_t = unsigned int]’ /usr/local/include/iguana/pb_writer.hpp:135:32: required from ‘iguana::detail::to_pb_impl<0>(const input_t&, uint32_t*&, iguana::memory_writer&)::<lambda(auto:318)> [with auto:318 = std::integral_constant<long unsigned int, 15>]’ /usr/local/include/iguana/pb_util.hpp:338:22: required from ‘constexpr void iguana::detail::for_each_n(F&&, std::index_sequence<__indices ...>) [with F = to_pb_impl<0>(const input_t&, uint32_t*&, iguana::memory_writer&)::<lambda(auto:318)>; long unsigned int ...I = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}; std::index_sequence<__indices ...> = std::integer_sequence<long unsigned int, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15>]’ /usr/local/include/iguana/pb_writer.hpp:114:15: required from ‘void iguana::detail::to_pb_impl(Type&&, uint32_t*&, Writer&) [with unsigned int key = 0; bool omit_default_val = true; Type = const input_t&; Writer = iguana::memory_writer; uint32_t = unsigned int]’ /usr/local/include/iguana/pb_writer.hpp:482:26: required from ‘void iguana::to_pb(const T&, Stream&) [with T = input_t; Stream = std::__cxx11::basic_string<char>; typename std::enable_if<(ylt_refletable_v<T> || is_custom_reflection_v<T>), int>::type <anonymous> = 0]’ src/main.cpp:32:18: required from here /usr/local/include/iguana/pb_util.hpp:200:61: error: invalid conversion from ‘uint8_t*’ {aka ‘unsigned char*’} to ‘const char*’ [-fpermissive] 200 | ((temp = static_cast<uint8_t>(v >> (7 * I)), writer.write(&temp, 1)), ...); | ^~~~~ | | | uint8_t* {aka unsigned char*} In file included from /usr/local/include/iguana/common.hpp:4, from /usr/local/include/iguana/dynamic.hpp:2, from /usr/local/include/ylt/struct_pb/struct_pb_impl.hpp:17: /usr/local/include/iguana/util.hpp:200:26: note: initializing argument 1 of ‘void iguana::memory_writer::write(const char*, std::size_t)’ 200 | void write(const char* data, std::size_t len) { | ~~~~~~~~~~~~^~~~
全部demo代码
#include <iostream> #include <ylt/struct_pb.hpp> struct input_t { int32_t test; int32_t test1; int32_t test2; std::string tf1; std::string tf2; std::string tf3; std::string tf4; int32_t tf5; int32_t tf6; std::string tf7; int32_t tf8; std::string tf9; std::string tf10; std::string tf11; std::string tf12; std::string tf13; }; int main(int argc, char** argv) { // 模拟数据 input_t data; data.tf13 = "test"; // 序列化 std::string ss; iguana::to_pb(data, ss); std::cout << ss << std::endl; std::cout << "hello world!" << std::endl; return 0; }
The text was updated successfully, but these errors were encountered:
由于缺少tag,我查了一下,对应的代码版本 d07ad5a
d07ad5a
Sorry, something went wrong.
是一个编译错误,等pr #333 合并之后就可以了。
Successfully merging a pull request may close this issue.
问题:当struct的第一个字段
int32_t test;
被注释的情况下,才可以编译通过,否则报错全部demo代码
The text was updated successfully, but these errors were encountered: