public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: paolo@gcc.gnu.org
To: a.metselaar@math.utwente.nl, gcc-bugs@gcc.gnu.org,
	gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org, paolo@gcc.gnu.org
Subject: Re: libstdc++/5012: cannot instantiate std::binder1st<std::mem_fun1_t<void, unary_functor<const int&, void\>, const int&> >
Date: Wed, 26 Dec 2001 03:57:00 -0000	[thread overview]
Message-ID: <20011226115719.14962.qmail@sources.redhat.com> (raw)

Synopsis: cannot instantiate std::binder1st<std::mem_fun1_t<void, unary_functor<const int&, void\>, const int&> >

Responsible-Changed-From-To: unassigned->paolo
Responsible-Changed-By: paolo
Responsible-Changed-When: Wed Dec 26 03:57:19 2001
Responsible-Changed-Why:
    Taking care of it
State-Changed-From-To: open->feedback
State-Changed-By: paolo
State-Changed-When: Wed Dec 26 03:57:19 2001
State-Changed-Why:
    As written, your code leads to a "reference to a reference"
    problem, which is definitely *not* a library bug
    (according to the standard, 20.3.6.1, binder1st has
     typename Operation::result_type
       operator()(const typename Operation::second_argument_type& x) const;)
    
    Perhaps would serve your needs a variant like:
    
    #include <functional>
    using namespace std;
    
    template <class Arg, class Res> 
    struct unary_functor : public unary_function<Arg,Res>
    {
      virtual ~unary_functor() {}
      virtual Res operator() (Arg x) =0;
      binder1st<mem_fun1_t<Res, unary_functor<Arg,Res>, Arg> > 
      func()
      { return bind1st(mem_fun(&unary_functor<Arg,Res>::operator()),this); }
    } ;
    
    class F : public unary_functor<int,void>
    {
      void operator() (int i) { return; }
    } f;
    
    
    int main()
    {
      f.func();
    }
    
    ???

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5012


             reply	other threads:[~2001-12-26 11:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-12-26  3:57 paolo [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-01-21 20:57 rodrigc
2001-12-04 11:46 a.metselaar

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=20011226115719.14962.qmail@sources.redhat.com \
    --to=paolo@gcc.gnu.org \
    --cc=a.metselaar@math.utwente.nl \
    --cc=gcc-bugs@gcc.gnu.org \
    --cc=gcc-gnats@gcc.gnu.org \
    --cc=gcc-prs@gcc.gnu.org \
    --cc=nobody@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: link
Be 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).