felixguendling / cista

Cista is a simple, high-performance, zero-copy C++ serialization & reflection library.
https://cista.rocks
MIT License
1.78k stars 113 forks source link

cista_members() approach: serialize tuples properly #166

Closed AdelKS closed 1 year ago

AdelKS commented 1 year ago

Hello!

While migrating code to the new approach, here's something that seems to not be handled properly with the new approach:

struct A
{
  std::tuple<std::tuple<int, int>, int> vals;

  A() : vals({ {1, 2}, 3}) {}

  auto cista_members()
  {
    return std::tie(vals);
  }
};

int main()
{
  A a;
  cista::byte_buf buffer = cista::serialize(a);
  return 0
}
felixguendling commented 1 year ago

Using cista::tuple instead of std::tuple works.

AdelKS commented 1 year ago

Oh it's again a matter of supporting STL containers I suppose, alright thanks !