我发现了以下行为std::function和类型演绎,这对我来说意外:
#include <functional>
template <typename T>
void stdfunc_test(std::function<T(T)> func) {};
int test_func(int arg)
{
return arg + 2;
}
int main()
{
stdfunc_test([](int _) {return _ + 2;});
stdfunc_test(test_func);
}
Run Code Online (Sandbox Code Playgroud)
两行都main导致错误:
没有函数模板"stdfunc_test"的实例与参数列表匹配
尝试在Visual Studio 2015中编译时.
为什么类型扣除不会从函数类型中扣除模板类型,是否有解决方法?
我已经读过,ncurses可以支持多达256种颜色和多达32k种颜色对.虽然我自己设置了256种颜色,但我找不到有关如何设置32k颜色对的任何信息.
的结果
printf("%d - %d\n", COLORS, COLOR_PAIRS);
Run Code Online (Sandbox Code Playgroud)
是
256 - 256
Run Code Online (Sandbox Code Playgroud)
虽然2个颜色和2个颜色对可能足够铁杆终端粉丝,我想知道如何从库中获取最多的颜色.