标签: c++ operators c++14 function-pointers built-in
在C ++中有没有办法获得指向内置算术运算符的指针?这样的事情doesn't compile:
const auto addition = static_cast<int(*)(int, int)>(operator+);
此问题的一个简单解决方法是make an auxiliary lambda:
const auto addition = +[](const int a, const int b){ return a + b; };
但还有其他解决方案吗?