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

Error trying to push back vector of futures to vector #2399

Closed
folshost opened this issue Nov 18, 2016 · 2 comments
Closed

Error trying to push back vector of futures to vector #2399

folshost opened this issue Nov 18, 2016 · 2 comments

Comments

@folshost
Copy link
Contributor

folshost commented Nov 18, 2016

In the following code, I'm attempting to create a vector of vectors of double futures, but am getting an error when trying to push the vector of double futures onto the parent vector. I talked with Samuel about it, and he thinks that it is an HPX problem, so I'm putting it up here to let you guys know about it.

Here's the code:

#include <hpx/hpx_main.hpp>
#include <hpx/include/lcos.hpp>
#include <hpx/include/actions.hpp>

#include <vector>

double get_rand() {
    return (double)(rand() % 100);
}
HPX_PLAIN_ACTION(get_rand, get_rand_action);

int main(int argc, char* argv[])
{
    hpx::naming::id_type here = hpx::find_here();

    std::vector< std::vector< hpx::lcos::future<double> > > futuresParent;
    for (int i = 0; i < 10; i++)
    {		
        std::vector< hpx::lcos::future<double> > futures;
        for (int j = 0; j < 10; j++)
        {
        futures.push_back(hpx::async<get_rand_action>(here));
        }
		
        futuresParent.push_back(futures); // This line causes the error
    }	
	
    return 0;
}

Here's the error:

Severity Code Description Project File Line Suppression State
Error C2248 'hpx::lcos::future::future': cannot access private member declared in class 'hpx::lcos::future' matrix_matrix_hpx_single_file_error_exe C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\xmemory0 655

As the error points out, I'm working on this with Visual Studio (2015), on Windows 7.

By the way, my name is Maxwell Reeser, and I'm an undergrad working at CCT on Chancellor's Student Aid.

@K-ballo
Copy link
Member

K-ballo commented Nov 18, 2016

The line causing the error is trying to copy a vector<future>, which cannot be done as futures are not copyable. Presumably the code should move the local vector into the parent vector, rather than attempting to insert a copy and then discarding the original.

@hkaiser
Copy link
Member

hkaiser commented Nov 18, 2016

I'll close this as invalid, feel free to comment if you have further questions.

@hkaiser hkaiser closed this as completed Nov 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants