我收到以下错误:
prog.cpp: In member function 'void Sequence::GetSequence()':
prog.cpp:45: error: 'itoa' was not declared in this scope
我已经包含 cstdlib 头文件,但它不起作用。
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <functional>
using namespace std;
template<typename T>
struct predicate :
public binary_function<T, T, bool>
{
bool operator() (const T& l,const T &r) const
{
return l < r;
}
};
class Sequence
{
public:
Sequence(vector<string> &v)
{ /* trimmed */ }
void GetSequence(void)
{
string indices = "";
char buf[16];
for( map<int, string>::iterator
i = m.begin(); i != m.end(); ++i )
{
indices = indices
+ string(itoa((i->first), buf, 10));
}
SortedSequence("", indices);
}
// --- trimmed ---