Coder Social home page Coder Social logo

Can't create observable about rxcpp HOT 5 CLOSED

reactivex avatar reactivex commented on May 14, 2024
Can't create observable

from rxcpp.

Comments (5)

kirkshoop avatar kirkshoop commented on May 14, 2024

Intellisense is separate from the complier. I have tried rxcpp with vs2013 and vs2015 on windows and they should compile the cep example.

from rxcpp.

antlafarge avatar antlafarge commented on May 14, 2024

Okay I confirm.
So the project is too complex for intellisense ! ^^
Thank you.

from rxcpp.

antlafarge avatar antlafarge commented on May 14, 2024

Hello I'm back ! I encounter another problem (Access violation reading) when I try to create the observable (at runtime). the subscriber seams to be invalid in the called lambda.

Here is a part of code :

rx::observable<Packet*> Scene::onMessage(Route* route)
{
    auto observable = rx::observable<>::create<Packet*>([this, route](rx::subscriber<Packet*> subscriber) {
        auto handler = new function<void(Packet*)>([this, &subscriber](Packet* p) {
            auto packet = new Packet(host(), p->stream, p->metadata());
            subscriber.on_next(packet); // Access violation reading location here !
        });

        route->handlers.push_back(handler);

        subscriber.add([route, handler]() {
            auto it = find(route->handlers.begin(), route->handlers.end(), handler);
            route->handlers.erase(it);
            delete handler;
        });
    });
    return observable.as_dynamic();
}

What can be the issue?

from rxcpp.

kirkshoop avatar kirkshoop commented on May 14, 2024

Briefly, I am traveling.

The &subscriber must be subscriber. Without this the subscriber lifetime is over when the subscribe method exits.

from rxcpp.

antlafarge avatar antlafarge commented on May 14, 2024

Okay it works !
Thanks

from rxcpp.

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.