我想写一些类似的东西:
// I don't know how this particular syntax should look...
template FunctorT>
Something MergeSomething(const Something& lhs, const Something& rhs)
{
Something result(lhs);
if (lhs.IsUnsigned() && rhs.IsUnsigned())
{
result.SetUnsigned(FunctorT()(lhs.UnsignedValue(), rhs.UnsignedValue()));
}
else
{
result.SetSigned(FunctorT<__int64>()(lhs.SignedValue(), rhs.SignedValue()));
}
return result;
}
这将被用于:
Something a, b;
Something c = MergeSomething<:plus>(a, b);
我怎么做?