Member-Function Pointers With Default Arguments
<p>I am trying to create a pointer to a member function which has default arguments.  When I call through this function pointer, I do not want to specify an argument for the defaulted argument.  This is disallowed according to the standard, but I have never before found anything that the standard disallowed that I could not do in some other conformant way.  So far, I have not found a way to do this.</p>

<p>Here is code illustrating the problem I'm trying to solve:</p>

<pre><code>class MyObj
{
public:
 int foo(const char* val) { return 1; }
 int bar(int val = 42) { return 2; }
};

int main()
{
 MyObj o;

 typedef int(MyObj::*fooptr)(const char*);
 fooptr fp = &amp;MyObj::foo;
 int r1 = (o.*fp)("Hello, foo.");

 typedef int(MyObj::*barptr)(int);
 barptr bp1 = &amp;MyObj::bar;
 int r2 = (o.*bp1)(); // &lt;-- ERROR: too few arguments for call

 typedef int (MyObj::*barptr2)();
 barptr2 bp2 = &amp;MyObj::bar; // &lt;-- ERROR: Can't convert from int(MyObj::*)(int) to int(MyObj::*)(void)
 int r3 = (o.*bp2)();
    return 0;
}
</code></pre>

<p>Any ideas on how to do this <em>in conformant C++</em> if I do not want to specify any values for the defaulted arguments?</p>

<p>EDIT:  To clarify the restrictions a bit.  I do not want to specify any default arguments either in the call or in any typedef.  For example, I do not want to do this:</p>

<pre><code>typedef int(MyObj::*barptr)(int = 5);
</code></pre>

<p>...nor do I want to do this:</p>

<pre><code>typedef int(MyObj::*barptr)(int);
...
(o.barptr)(5);
</code></pre>
