Giter VIP home page Giter VIP logo

Comments (2)

cbeck88 avatar cbeck88 commented on May 30, 2024 1

Hi,

I've looked at Cereal in the past, but not too recently. IIRC it's like, you add the visitation function to your struct, so,

struct my_struct {
    int a;
    float b;
    double c;

    template <typename A>
    void archive(A & archiver) {
        archiver(a);
        archiver(b);
        archiver(c);
    }
};

and then Cereal picks up on the existence of the archive template member function and uses it to visit the struct.

I think that visit_struct cannot create a compatibility layer like with Fusion and Hana to this API, because it gives me no way to determine the struct member names.

However, maybe we can make a patch in Cereal, so that if your struct does not have an ::archive function, then it checks if it is a visitable structure and tries to use the visit_struct api instead? Cereal would then also get the benefit of the hana and fusion compat layers I think.

from visit_struct.

mdimura avatar mdimura commented on May 30, 2024

It seems, you are right. I think, a patch for Cereal would be great. Thank you for the response!

no way to determine the struct member names.

Yep, apparantly, Cereal uses default names like value0 if no other name is provided:

archive( CEREAL_NVP(m1), // Names the output the same as the variable name
        someInt,        // No NVP - cereal will automatically generate an enumerated name
        cereal::make_nvp("this_name_is_way_better", d) ); // specify a name of your choosing

from visit_struct.

Related Issues (18)

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.