Skip to content

Static type hashing of std::complex #177

@AdelKS

Description

@AdelKS

Hello,

I came across the need to serializing an std::array<std::complex<double>, N> and static type hashing doesn't have the specialization of std::complex, would be awesome to have. std::complex<T> have strict requirements where it must be equivalent to a C array of two T types, so there shouldn't be any fundamental issues.

This work as a workaround:

class A: public std::array<std::complex<double>, N>
{
public: 
   using std::array<std::complex<double>, N>::array;
  
  auto cista_members()
  {
    return std::tie(*reinterpret_cast<std::array<double, 2*N>*>(this));
  }
};

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions