Coder Social home page Coder Social logo

Projection with any() ? about flux HOT 2 CLOSED

calebtt avatar calebtt commented on June 5, 2024
Projection with any() ?

from flux.

Comments (2)

calebtt avatar calebtt commented on June 5, 2024

Nevermind, this works:

return !flux::ref(mappingsList).any(flux::proj([](const auto vk) { return vk == 0; },&CBActionMap::ButtonVirtualKeycode));

from flux.

tcbrindle avatar tcbrindle commented on June 5, 2024

Replacing some of my ranges filter stuff with flux made it around 25% faster

That's great to hear!

Documentation doesn't really refer to flux::proj() much at all, beyond a couple instances of it's usage.

Yeah, there's lots of stuff missing from the documentation at the moment, it definitely needs improvement

Nevermind, this works:

return !flux::ref(mappingsList).any(flux::proj([](const auto vk) { return vk == 0; },&CBActionMap::ButtonVirtualKeycode));

Glad to hear you figured it out! If you're interested, I think the following should be equivalent but is a bit shorter and perhaps more readable: (the generated code should be the same though)

return flux::all(mappingsList, flux::proj(flux::pred::nonzero, &CBActionMap::ButtonVirtualKeycode));

If you have any more questions about Flux please let me know :)

from flux.

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.