Code Monkey home page Code Monkey logo

Comments (5)

MaxSagebaum avatar MaxSagebaum commented on August 18, 2024 1

This is a good point. Detecting this and adding the include could be an easy fix.

If this is not desired an other fix would be to split cpp2regex.h2 into two parts. The parsing part and the runtime part. Only the runtime part is actually required after applying @regex.

from cppfront.

hsutter avatar hsutter commented on August 18, 2024 1

Circling back: This has now been fixed in #1219, thanks again @bluetarpmedia for pointing this out!

"Don't pay for what you don't use" FTW. 👍

from cppfront.

bluetarpmedia avatar bluetarpmedia commented on August 18, 2024

That's interesting... does that mean we could do both? Only conditionally include the runtime part for the lowered C++ code?

from cppfront.

hsutter avatar hsutter commented on August 18, 2024

an other fix would be to split cpp2regex.h2 into two parts. The parsing part and the runtime part. Only the runtime part is actually required after applying @regex.

When I was reviewing the PR I thought of this, but I didn't grok it well enough to know what parts are the metafunction-at-compile-time part and what part is the runtime-support-library part.

I think a good first step would be to move the metafunction-only parts right into reflect.h2.

from cppfront.

MaxSagebaum avatar MaxSagebaum commented on August 18, 2024

I performed the split in #1219.

I also tried to add the functionality for adding the include on the fly. But my understanding of cppfront is too limited. Unlinke my MR for enabling metafunction to add code outside of the context (#809), this is not straight forward.

@hsutter Can you have look or give me some pointers on how to do this?
After such a change, adding the include should be something like t.add_include("#include \"cpp2regex.h2\""); in regex_gen.

from cppfront.

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.