public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "denes.matetelki at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/61075] parallel std::accumulate reduct type cannot be different than the iterated type Date: Tue, 06 May 2014 09:47:00 -0000 [thread overview] Message-ID: <bug-61075-4-eML4C1sbMk@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-61075-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61075 Denes Matetelki <denes.matetelki at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Host| |Linux 3.13.5-gentoo #10 | |SMP Fri Apr 25 16:12:35 | |CEST 2014 x86_64 Intel(R) | |Xeon(R) CPU W3690 @ 3.47GHz | |GenuineIntel GNU/Linux --- Comment #1 from Denes Matetelki <denes.matetelki at gmail dot com> --- #include <vector> #include <numeric> #include <iostream> class Custom { public: Custom(int i) : m_i(i) {} int getI() const { return m_i; } private: int m_i; }; int main (int /*argc*/, char* /*argv*/[]) { std::vector<int> v(10, 1); const int v_sum = std::accumulate(v.begin(), v.end(), 0, [](int sum, int i) { return sum + i; } ); std::vector<Custom> v2(10, Custom(1)); const int v2_sum = std::accumulate(v2.begin(), v2.end(), 0, [](int sum, const Custom& c) { return sum + c.getI(); } ); return 0; } Compiling with parallel mode: parallel_accumulate.cpp:33:93: required from here /usr/lib/gcc/x86_64-pc-linux-gnu/4.8.2/include/g++-v4/parallel/par_loop.h:102:15: error: cannot convert 'std::__iterator_traits<__gnu_cxx::__normal_iterator<Custom*, std::vector<Custom> >, true>::value_type {aka Custom}' to 'int' in initialization __reduct = new _Result(__f(__o, __begin + __start));
next parent reply other threads:[~2014-05-06 9:47 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-61075-4@http.gcc.gnu.org/bugzilla/> 2014-05-06 9:47 ` denes.matetelki at gmail dot com [this message] 2014-05-06 10:55 ` [Bug libstdc++/61075] " denes.matetelki at gmail dot com 2014-05-06 14:54 ` redi at gcc dot gnu.org 2014-05-13 9:07 ` denes.matetelki at gmail dot com 2014-05-13 9:24 ` redi at gcc dot gnu.org 2014-05-13 10:45 ` denes.matetelki at gmail dot com 2014-05-13 10:48 ` redi at gcc dot gnu.org 2014-05-16 14:53 ` denes.matetelki at gmail dot com
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-61075-4-eML4C1sbMk@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).