[英]backtracking knapsack implementation with C++
I am trying to implement backtracking knapsack solution with C++ which was from this website. 我正在尝试使用来自该网站的C ++实现回溯背包解决方案。 But I get error at line std::move part, that says that std does not support move.
但是我在std :: move部分出现错误,说std不支持move。 Is there a solution for that?
有解决方案吗? Is that because of my development environment?
那是因为我的开发环境吗?
if (issol == true)
{
if (! vsol.empty()) vsol.clear();
std::move(temp.begin(), temp.end(), std::back_inserter(vsol));
temp.clear();
issol = false;
} else temp.clear();
return;
std::move
is a new feature starting from C++11 which requires including <utility>
header file. std::move
是从C ++ 11开始的一项新功能,需要包含<utility>
头文件。 So, check if you have #included this header file. 因此,请检查您是否已#included此头文件。 Also, if you do not find this file then probably your development environment does not support C++11.
另外,如果找不到此文件,则说明您的开发环境可能不支持C ++ 11。
Reference: std::move 参考: std :: move
只包含实用程序
#include <utility>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.