It should not be possible. They will be considered as the first two.
You can simply create a function with a different name using two arguments and a call to f .
Alternatively, if you want to emulate named arguments, you can use something similar to smooth interfaces . Example:
#include <iostream> using namespace std; int f_impl(int a,int b, int c, int d){ cout << a << " " << b << " " << c << " " << d << endl; return 42; } struct f{ int _a, _b, _c, _d; f() : _a(10), _b(20), _c(30), _d(40){} f& a(int a){ _a = a; return *this;} f& b(int b){ _b = b; return *this;} f& c(int c){ _c = c; return *this;} f& d(int d){ _d = d; return *this;} int operator()(){ return f_impl(_a, _b, _c, _d); } };
Output:
100 20 300 40 10 1000 30 4000 42
Vlad
source share