Giter VIP home page Giter VIP logo

Comments (4)

FlorianWolters avatar FlorianWolters commented on July 26, 2024

This issue is a duplicate of #33. Sorry, but maybe the information provided here helps too.

from better-enums.

FlorianWolters avatar FlorianWolters commented on July 26, 2024

This is also a problem if using Better Enums in a container, e.g. std::array<Boolean, 8>. Another example is this usage of boost::program_options:

boost::program_options::value<Boolean>(&boolean_)
      ->required()

What do I have to change to get rid of this bug? I think a workaround would be to initialize a Better Enum to the value of the first enumerator by default (or better: to no value, UB - same as with enum class), but I cannot find the construction code (too much macros and templates). 😢

from better-enums.

FlorianWolters avatar FlorianWolters commented on July 26, 2024

I think I got it. I modified https://github.com/aantron/better-enums/blob/master/enum.h#L1041 and changed private to public. Now I still have a problem with the boost::program_options::value<Boolean>(&boolean_) call:

D:\win-dev-env\native\boost\boost-1.63.0-x86\include\boost-1_63\boost\lexical_cast\detail\converter_lexical.hpp:243: Fehler: C2338: Target type is neither std::istream`able nor std::wistream`able

Why doesn't boost pick up the operator >> in enum.h?

Edit: I've used the latest release version and updated to HEAD now. Still the constructor visibility is bugged. But despite that it seems to work now.

from better-enums.

FlorianWolters avatar FlorianWolters commented on July 26, 2024

Doh, I did not see http://aantron.github.io/better-enums/DesignDecisionsFAQ.html, so nevermind. Your library is awesome. For others: This link describes how-to change default behavior.

from better-enums.

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.