I get the following error:
prog.cpp: In the member function 'void Sequence :: GetSequence ():
prog.cpp: 45: error:' itoa was not declared in this area
I have a cstdlib header file, but it does not work.
#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)
{ }
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);
}
source
share