[Bug libstdc++/57283] New: missing typedefs in specialized std::mem_fn for member variables

2013-05-15 Thread record.nctu.cis91 at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57283

Bug ID: 57283
   Summary: missing typedefs in specialized std::mem_fn for member
variables
   Product: gcc
   Version: 4.7.2
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libstdc++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: record.nctu.cis91 at gmail dot com

Created attachment 30118
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30118&action=edit
code-reproduce-this-issue.cpp

I found that gcc complain that "no type named ‘argument_type’ in ‘class
std::_Mem_fn’", with the code in attachment.

Then I try to locate the problem and find there is no any typedefs for
argument_type.
So I guess it's missing the required typedefs.

[Bug libstdc++/57283] missing typedefs in specialized std::mem_fn for member variables

2013-05-15 Thread record.nctu.cis91 at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57283

--- Comment #2 from Lin Yi-Li  ---
Sorry I missed that 'pm is a pointer to member function...'.

I know that C++11 has lambda, but using std::mem_fn is sometimes much clear.
But according to standard, value from std::mem_fn for variable will not be able
to work with std::not1. Even if the usage is similiar to the one for member
function takes no argument.

So is it possible to be an enhancement?


[Bug libstdc++/57283] missing typedefs in specialized std::mem_fn for member variables

2013-05-16 Thread record.nctu.cis91 at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57283

--- Comment #5 from Lin Yi-Li  ---
(In reply to Jonathan Wakely from comment #4)
> N.B. you can also do it with a nested std::bind expression and
> std::logical_not
> 
> std::bind(std::logical_not(),
>   std::bind(std::mem_fn(&cls::value), std::placeholders::_1))
> 
> in C++14 that means you can provide a working not1 replacement:
> 
> template
> auto not1(F f)
> {
> return std::bind(std::logical_not<>(), std::bind(f,
> std::placeholders::_1));
> }

I understand the problem of std::mem_fn + member variable now.
Thank you for your explanation.