Is it possible to overload multiple times operator() ? For example for

using one or two arguments ? My visual c++ does not seem to like it :

I was trying to implement an arbitrary integer precision class (I know

such libraries already exist) and I wrote the following piece of code

:

template <typename T> class plus_with_carry {

public:

plus_with_carry(void) : carry(false) {};

T operator() (const T& left, const T& right) {

T temp = left + right + ((carry) ? 1 : 0);

carry = (temp<left);

};

T operator() (const T& arg) {

T temp = arg + ((carry) ? 1 : 0);

carry = (temp<arg);

};

bool carry;

};

to be used as a functor in the CBigInt operator+ (not yet complete) :

const CBigInt operator+ (const CBigInt& left, const CBigInt&

right) {

CBigInt temp;

if (left.sign==right.sign) {

std::vector<typename CBigInt::T>::size_type

sizel =

left.values.size();

std::vector<typename CBigInt::T>::size_type

sizer =

right.values.size();

temp.sign=left.sign;

plus_with_carry<typename CBigInt::T> myplus();

if (sizel<sizer) {

temp.values.reserve(sizer);

std::transform(left.values.begin(),

left.values.end(),

right.values.begin(),

std::back_inserter(temp.values), myplus);

std::transform(right.values.begin()+sizel, right.values.end(),

std::back_inserter(temp.values), myplus);

} else {

temp.values.reserve(sizel);

std::transform(right.values.begin(),

right.values.end(),

left.values.begin(),

std::back_inserter(temp.values), myplus);

std::transform(left.values.begin()+sizer, left.values.end(),

std::back_inserter(temp.values), myplus);

}

} else {

}

return temp;

}

but my compiler does not find the binary version of the functor

plus_with_carry...

Is this a problem with my way of writing the functor ? Is this allowed

by the standard ?

Thanks in advance for your help,

Charles