Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local dataflow with unwrap: functor operators need to be const #773

Closed
mariomulansky opened this issue May 28, 2013 · 0 comments

Comments

Projects
None yet
2 participants
@mariomulansky
Copy link
Contributor

commented May 28, 2013

I updated to the newest version with improved local dataflows. Now I have to define the ()-operator as const in my functors, which was not necessary before. Here's a minimal example showing the problem:

#include <hpx/hpx.hpp>
#include <hpx/hpx_main.hpp>
#include <hpx/lcos/local/dataflow.hpp>
#include <hpx/util/unwrap.hpp>

typedef hpx::lcos::future< double > future_type;

template< typename Value >
struct mul 
{
    const Value a;

    mul( const Value alpha ) : a( alpha )
    { }

    double operator() ( double x1 , double x2 ) //const // this has to be const?!
    {
        return x1*x2*a;
    }
};

int main()
{
    auto functor = hpx::util::unwrap(mul<double>( 0.5 ));
    future_type f1 = hpx::make_ready_future( 1.0 );
    future_type f2 = hpx::lcos::local::dataflow( functor , f1 , f1 );

    return 0;
}

@ghost ghost assigned sithhell May 28, 2013

hkaiser added a commit that referenced this issue May 30, 2013

@sithhell sithhell closed this May 31, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.