GithubHelp home page GithubHelp logo

Comments (7)

SpriteOvO avatar SpriteOvO commented on May 23, 2024

""_sig only accepts string from compile-time, it needs changes to support runtime signature parsing.

from sigmatch.

MattMills avatar MattMills commented on May 23, 2024

OK, I've changed the title to represent a feature request instead, assuming you are OK with that... if not I can try to fork and see if I can manipulate the existing code to implement it myself, but to be honest your C++ is much more advanced than my understanding, I haven't learned many of these newer features.

from sigmatch.

SpriteOvO avatar SpriteOvO commented on May 23, 2024

Some hints:

  1. Changing the consteval to constexpr for all function involved in _sig function, this makes them can be called at both runtime and compile-time.

  2. During the first step, you need to figure out how to reimplement the macro SIGMATCH_CONSTEVAL_STATIC_ASSERT in order to report an error to caller for runtime parsing. (Probably have to use if constexpr and std::is_constant_evaluated)

  3. Make a static member function for signature for runtime parsing, e.g.

    signature signature::parse(std::string_view) noexcept

Feel free to try it out if you wish, just make it work for yourself and then you can learn a lot from it ;)

I will try to officially implement it in this repo after I finish my other work.

from sigmatch.

MattMills avatar MattMills commented on May 23, 2024

Thanks for the tips, I've messed with it for a while but I need to go learn more modern C++; I think I probably learned on C++98...

from sigmatch.

MattMills avatar MattMills commented on May 23, 2024

@SpriteOvO if I can bother you for another hint, I've spent some more time on this and where I'm stuck right now is what the heck to do with consteval_str_buffer... since it takes size as a template arg and that needs to be a compile time constant; am I looking at this in the wrong way, or do I just need to add a second struct with a dynamically sized array?

from sigmatch.

SpriteOvO avatar SpriteOvO commented on May 23, 2024

do I just need to add a second struct with a dynamically sized array?

@MattMills No, constexpr can handle std::string_view well, so consteval_str_buffer is only needed for the entry consteval function parse_sig_str. For deeper functions, the NTTP consteval_str_buffer can be simply replaced with a normal parameter std::string_view.

Don't worry, I have started trying implement it in this repo officially.

from sigmatch.

SpriteOvO avatar SpriteOvO commented on May 23, 2024

Implemented in #5.

from sigmatch.

Related Issues (4)

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.