我已经看到模板不能用double定义,因为它不是整数值。例如,以下代码将无法编译:
template <double x> double func()
{
return x;
}
Run Code Online (Sandbox Code Playgroud)
但是,我想知道为什么在STL中允许定义double容器吗?谢谢!
我正在尝试在 VS2019 中编译以下代码:
auto moveToEnd = []<typename T>(std::vector<T>& into, std::vector<T>& from)
{
into.insert(std::end(into), std::make_move_iterator(std::begin(from))
, std::make_move_iterator(std::end(from)));
};
Run Code Online (Sandbox Code Playgroud)
但是,我收到一个错误:
'<' 在 lambda 主体之前跳过意外的标记/秒
注意:我使用的是 C++14 编译器。