Skip to content Skip to footer
0 items - $0.00 0

Show HN: Hexi – Modern header-only network binary serialisation for C++ by Chaosvex

Show HN: Hexi – Modern header-only network binary serialisation for C++ by Chaosvex

Show HN: Hexi – Modern header-only network binary serialisation for C++ by Chaosvex

13 Comments

  • Post Author
    gregschlom
    Posted March 28, 2025 at 6:11 pm

    Semi off-topic, but I just love the header image and the advice frog in the readme. Makes reading the documentation more fun and enjoyable.

  • Post Author
    nightowl_games
    Posted March 28, 2025 at 6:41 pm

    Wow that api looks fantastic! Bravo!

    I'd like to read an even more thorough overview of how it works and all the gotchas before I'd consider using this 'in production' but the API looks very easy to use and very elegant.

    EDIT: just hit the section on portability, seems like you would always have to use that API, yeah? I feel like when you are writing network code you simply have to make it portable from the get-go. I guess I'm always thinking about having it run on client machines.

  • Post Author
    klaussilveira
    Posted March 28, 2025 at 6:45 pm

    It's been a while since I saw a new library with such a clean interface. Congrats!

  • Post Author
    codedokode
    Posted March 28, 2025 at 7:13 pm

    It doesn't look like zero-copy though in this example:

        UserPacket packet;
        stream >> packet;
    

    That is at least one copy.

  • Post Author
    Jyaif
    Posted March 28, 2025 at 7:23 pm

    Your lib requires manually creating both a serializing and deserializing function.
    If the functions are out of sync, bad things happen.

    Consider copying Cereal, which solves this problem by requiring you to create a single templated function ( https://uscilab.github.io/cereal/ )

  • Post Author
    codedokode
    Posted March 28, 2025 at 7:27 pm

    By the way I looked through the code, and had to read about metaprogramming in C++. I wonder why is it so complicated? For example, why constraints like std::is_integral are represented by structs. Doesn't make much sense to me. A function wouldn't be better here?

  • Post Author
    connicpu
    Posted March 28, 2025 at 7:31 pm

    I know it's a convention since the inception of the language, but the operator overload abuse of the bitshift operator still makes me sad every time I see it :(

  • Post Author
    423642643
    Posted March 28, 2025 at 9:06 pm

    [dead]

  • Post Author
    abcd_f
    Posted March 28, 2025 at 10:01 pm

    In the same vein, but without needing to create separate de- and serialize functions:

    https://github.com/eliasdaler/MetaStuff

    Another take on the same idea with even simpler interface:

    https://github.com/apankrat/cpp-serializer

  • Post Author
    huhtenberg
    Posted March 28, 2025 at 10:28 pm

    What are the exact constraints on the struct contents, i.e. what is it that your library can't serialize?

    I tried adding std::string to the UserPacket (from the README)

      struct UserPacket {
      //    uint64_t user_id;
      //    uint64_t timestamp;
      //    std::array<uint8_t, 16> ipv6;
            std::string test;
      };
    

    and the compilation fails – https://onlinegdb.com/B_RJd5Uws

  • Post Author
    Labo333
    Posted March 28, 2025 at 11:18 pm

    Fun! It reminds me of my own attempt at this: https://github.com/louisabraham/ubuf

    It can generate efficient JS and C++ from a simple YAML file.

  • Post Author
    rybosome
    Posted March 29, 2025 at 12:47 am

    Lovely API, great work on that.

  • Post Author
    curtisszmania
    Posted March 29, 2025 at 3:19 am

    [dead]

Leave a comment

In the Shadows of Innovation”

© 2025 HackTech.info. All Rights Reserved.

Sign Up to Our Newsletter

Be the first to know the latest updates

Whoops, you're not connected to Mailchimp. You need to enter a valid Mailchimp API key.