public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: bkoz@gcc.gnu.org To: bkoz@gcc.gnu.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, kenny.simpson@gs.com, nobody@gcc.gnu.org, theonetruekenny@yahoo.com Subject: Re: libstdc++/3113: DR 109: missing binders for non-const sequence elements Date: Mon, 11 Jun 2001 10:56:00 -0000 [thread overview] Message-ID: <20010611175627.5529.qmail@sourceware.cygnus.com> (raw) Synopsis: DR 109: missing binders for non-const sequence elements Responsible-Changed-From-To: unassigned->bkoz Responsible-Changed-By: bkoz Responsible-Changed-When: Mon Jun 11 10:56:25 2001 Responsible-Changed-Why: Mine. State-Changed-From-To: open->feedback State-Changed-By: bkoz State-Changed-When: Mon Jun 11 10:56:25 2001 State-Changed-Why: Umm. Here's a testcase: #include <vector> #include <algorithm> // for_each #include <functional> class Elem { public: void print(int i) const { } void modify(int i) { } }; // libstdc++/3113 void test01() { std::vector<Elem> coll(2); // OK std::for_each(coll.begin(), coll.end(), std::bind2nd(std::mem_fun_ref(&Elem::print), 42)); // OK std::for_each(coll.begin(), coll.end(), std::bind2nd(std::mem_fun_ref(&Elem::modify), 42)); } int main() { test01(); return 0; } making the following change: 2001-06-11 benjamin kosnik <bkoz@fillmore.constant.com> libstdc++/3113 * include/bits/stl_function.h (binder2nd): Fix as per DR 109. (binder1st): Same. * include/bits/std_queue.h: Add c++config.h. Index: include/bits/std_queue.h =================================================================== RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/std_queue.h,v retrieving revision 1.3 diff -c -p -r1.3 std_queue.h *** std_queue.h 2001/03/31 20:15:42 1.3 --- std_queue.h 2001/06/11 17:54:46 *************** *** 28,34 **** #define _CPP_QUEUE 1 #pragma GCC system_header ! #include <bits/stl_algobase.h> #include <bits/stl_alloc.h> #include <bits/stl_construct.h> --- 28,34 ---- #define _CPP_QUEUE 1 #pragma GCC system_header ! #include <bits/c++config.h> #include <bits/stl_algobase.h> #include <bits/stl_alloc.h> #include <bits/stl_construct.h> Index: include/bits/stl_function.h =================================================================== RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/stl_function.h,v retrieving revision 1.2 diff -c -p -r1.2 stl_function.h *** stl_function.h 2001/03/04 21:34:01 1.2 --- stl_function.h 2001/06/11 17:54:48 *************** public: *** 199,204 **** --- 199,210 ---- operator()(const typename _Operation::second_argument_type& __x) const { return op(value, __x); } + #ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS + // 109. Missing binders for non-const sequence elements + operator()(typename _Operation::second_argument_type& __x) const { + return op(value, __x); + } + #endif }; template <class _Operation, class _Tp> *************** public: *** 224,229 **** --- 230,241 ---- operator()(const typename _Operation::first_argument_type& __x) const { return op(__x, value); } + #ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS + // 109. Missing binders for non-const sequence elements + operator()(typename _Operation::first_argument_type& __x) const { + return op(__x, value); + } + #endif }; template <class _Operation, class _Tp> Still doesn't make the above compile: %COMP.sh 3113.cc /mnt/hd/bliss/src.gcc/libstdc++-v3/include/bits/stl_function.h: In member function `int std::binder2nd<_Operation>::operator()(typename _Operation::first_argument_type&) const [with _Operation = std::const_mem_fun1_ref_t<void, Elem, int>]': /mnt/hd/bliss/src.gcc/libstdc++-v3/include/bits/stl_algo.h:91: instantiated from `_Function std::for_each(_InputIter, _InputIter, _Function) [with _InputIter = std::__normal_iterator<Elem*, std::vector<Elem, std::allocator<Elem> > >, _Function = std::binder2nd<std::const_mem_fun1_ref_t<void, Elem, int> >]' 3113.cc:18: instantiated from here /mnt/hd/bliss/src.gcc/libstdc++-v3/include/bits/stl_function.h:236: void value not ignored as it ought to be /mnt/hd/bliss/src.gcc/libstdc++-v3/include/bits/stl_function.h: In member function `int std::binder2nd<_Operation>::operator()(typename _Operation::first_argument_type&) const [with _Operation = std::mem_fun1_ref_t<void, Elem, int>]': /mnt/hd/bliss/src.gcc/libstdc++-v3/include/bits/stl_algo.h:91: instantiated from `_Function std::for_each(_InputIter, _InputIter, _Function) [with _InputIter = std::__normal_iterator<Elem*, std::vector<Elem, std::allocator<Elem> > >, _Function = std::binder2nd<std::mem_fun1_ref_t<void, Elem, int> >]' 3113.cc:21: instantiated from here /mnt/hd/bliss/src.gcc/libstdc++-v3/include/bits/stl_function.h:236: void value not ignored as it ought to be Not quite sure how to solve this last bit. However, the patch doesn't cause any other problems and so it likely to go in anyway. http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=3113&database=gcc
next reply other threads:[~2001-06-11 10:56 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2001-06-11 10:56 bkoz [this message] -- strict thread matches above, loose matches on Subject: below -- 2001-06-11 12:05 bkoz 2001-06-10 22:56 theonetruekenny
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=20010611175627.5529.qmail@sourceware.cygnus.com \ --to=bkoz@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ --cc=gcc-prs@gcc.gnu.org \ --cc=kenny.simpson@gs.com \ --cc=nobody@gcc.gnu.org \ --cc=theonetruekenny@yahoo.com \ /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).