尝试对Integer数组进行排序,并在进行一些谷歌搜索后,使用了std::sort
并伴随了以下错误:namespace "std" has no member "sort"
,找到了解决方案。
只是为了反驳我没有使用std namespace 的任何限制,这是我的 header :
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
using namespace std;
最佳答案
加:
#include <algorithm>
如
std::sort()
引用页中所述。有关讨论
using namespace std;
的信息,请参见Using std Namespace,Why is "using namespace std" considered bad practice?和许多其他问题。