Giter Site home page Giter Site logo

Comments (9)

Loki-Astari avatar Loki-Astari commented on June 4, 2024

I just added a test for this issue.

But it compiles and generates no errors for me:
https://github.com/Loki-Astari/ThorsSerializer/blob/master/src/Serialize/test/Issue72Test.cpp

If you can modify this file to generate the same errors as you get I will accept the pull request and I can go from there.

Or if you want to reply here with more information so I can reproduce the error.

from thorsserializer.

ripe909 avatar ripe909 commented on June 4, 2024

Thanks. Well, again, this is way above my cpp skills.

It looks like the typedef for unsigned int and signed int is the same size as long unsigned int and long signed int with Newlib for arm-gcc-eabi, so "auto" can't deduce for the correct type for std::pair
I found this somewhat similar issue for another project: https://github.com/harfbuzz/harfbuzz/issues/451

This would explain why it doesn't compile for me, and it does for your compiler.

Fixing it is another matter. I tried to remove all of the templates for int and unsigned int but that didn't help

from thorsserializer.

Loki-Astari avatar Loki-Astari commented on June 4, 2024

Try this change on line 580 of Traits.h let me know if it fixes the issue:

auto sizeData = ....

///change to

std::initializer_list<std::pair<std::size_t, std::size_t>> sizeData =

from thorsserializer.

Loki-Astari avatar Loki-Astari commented on June 4, 2024

If that does not work try: 580 of Traits.h

std::make_pair(0UL, 0UL)

/// Change to

std::make_pair(std::size_t{0}, std::size_t{0})

from thorsserializer.

Loki-Astari avatar Loki-Astari commented on June 4, 2024

One of those two or both should resolve the issue.

For initializer_list<> to work all the elements have to be the same type.
So the function call is returning: addSizeEachMemberItem() is returning std::pair<std:size_t, std::size_t> and make_pair() is returning std::pair<unsigned long, unsigned long> on most systems these would match looks like maybe your system is using unsigned int for std::size_t which causes the issue. So either we make the list a specific type so the compiler does not need to deduce the type or we are more explicit on the type of the initial pair in the list.

from thorsserializer.

Loki-Astari avatar Loki-Astari commented on June 4, 2024

I see quite a few changes since my last pull!

Sine your last pull (which must have been more than 6 months ago) I have added support for BSON (this is a Binary Json format that is used by Mongo DB).

The advantages of BSON is that fields have a known size or are prefixed by their size (so easy to skip them).
The disadvantages of BSON is that it is not very human-readable and arrays are implemented in a clunky fashion. Additionally, if you store a lot of small integers then BSON is bulkier as it always uses four bytes for an integer and is scattered with size objects that take up space (though JSON is scattered with lots of white space so win/loose).

from thorsserializer.

ripe909 avatar ripe909 commented on June 4, 2024

Try this change on line 580 of Traits.h let me know if it fixes the issue:

auto sizeData = ....

///change to

std::initializer_list<std::pair<std::size_t, std::size_t>> sizeData =

I tested this change and it addresses the issue. Thank You!

from thorsserializer.

Loki-Astari avatar Loki-Astari commented on June 4, 2024

I will update the code and push.

from thorsserializer.

Loki-Astari avatar Loki-Astari commented on June 4, 2024

Pushed an update.
Closing issue.

from thorsserializer.

Related Issues (20)

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.