On 03/01/2016 03:31 PM, [email protected] wrote: > I came across an issue last night trying to initialize a vector of > futures. I first tried std::fill but I (obviously - in retrospect) > cant't assign a float to future<float>. hpx::fill also didn't work.
Yes, float to future directly doesn't work, hpx::make_ready_future(0.f); should though. However, I believe that std::fill (and hpx::parallel::fill) use the copy constructor. hpx::future is not copyable though. > > I also tried hpx::for_each and hpx::make_ready_future -- it surprised me > that this also wouldn't compile. I've yet to fully decipher the compiler > error, but I can say that it got stopped by the pseudo-concept / > enable_if. I'm not sure which parameter(s) were problematic. Not sure either, a testcase might help. > > I expect that an explicit loop will work -- that is shown in the > tutorials in the documentation - but was looking for an alternative > using a high level algorithm. > > It just occurred to me that std::generate might work, though I haven't > tried it. generate will work indeed, transform might be an option as well. > > I suppose I have 2 questions: > 1. Is there a canonical way to initialize a vector of futures? Depends on what you are after ... there is hpx::parallel::executor_traits<Executor>::execute which returns a vector of futures if the Shape arguments has been passed to it: http://stellar-group.github.io/hpx/docs/html/hpx/parallel/v3/executor_traits.html#idp33907472-bb > 2. Is there any reason why hpx::fill cannot fill futures - other than > lack of specialization? Is it semantically incorrect? If there are no > fundamental objections, I'd like to attempt to contribute a patch for this. Do you mean hpx::parallel::fill? That's just the parallel version of std::fill. > > Thanks- > Shmuel > > > Sent from my BlackBerry 10 smartphone on the Rogers network. > > > _______________________________________________ > hpx-users mailing list > [email protected] > https://mail.cct.lsu.edu/mailman/listinfo/hpx-users > -- Thomas Heller Friedrich-Alexander-Universität Erlangen-Nürnberg Department Informatik - Lehrstuhl Rechnerarchitektur Martensstr. 3 91058 Erlangen Tel.: 09131/85-27018 Fax: 09131/85-27912 Email: [email protected] _______________________________________________ hpx-users mailing list [email protected] https://mail.cct.lsu.edu/mailman/listinfo/hpx-users
