How Can Fix This Error With C++Builder

How Can Fix This Error With C++Builder(Tokyo)...E2285 Could not find a match for 'sort<_RanIt,_Pr>

Source:

Stack Overflow
4
Questions Jobs Tags Users Badges Ask
up vote
-2
down vote
favorite
How Can Fix This Error With C++Builder(Tokyo)...E2285 Could not find a match for 'sort<_RanIt,_Pr>
c++ sorting vector c++builder builder
How Can Fix This Error With C++Builder(Tokyo)...E2285 Could not find a match for 'sort<_RanIt,_Pr>

Source:

#include <vector>
#include <string>
#include <set>
#include <map>
#include <deque>
#include <algorithm>
using namespace std;



// ----------------
struct sfile {
// ----------------
u32 id;

// ----------------

// ----------------
u32 daddr;
u16 dport;
u32 saddr;
u16 sport;
u16 pid;
u8 mac[6];
// ----------------
u64 size;
u64 nsize_left;
string tag;
string name;
int color;
int h;
int seg_changed;
u32 t;
u32 timeout;
// ----------------
string data;
u32 speed_temp;
u32 speed;
// ----------------
bool keep;
bool deleteed;
bool tmp;
int fx;
// ----------------
};

// ----------------
typedef set<sfile>file_set;
file_set fs;
typedef vector< const sfile*>SortedFsList;
SortedFsList sfl;
char FsSortMode=1;
// ----------------

// ---------------------------------------------------------------------------
bool FsSorter(const sfile *a, const sfile *b) {
// --------------
int r = 1; //FsSorting(a, b);
// --------------
if (r > 0) {
return 1;
}
// --------------
if (r < 0) {
return 0;
}
// --------------
if (FsSortMode > 0) {
// --------------
if (a->id < b->id) {
return 1;
}
// --------------
if (a->id > b->id) {
return 0;
}
// --------------
}
// --------------
if (FsSortMode < 0) {
// --------------
if (a->id > b->id) {
return 1;
}
// --------------
if (a->id < b->id) {
return 0;
}
// --------------
}
// --------------
return 0;
// --------------
}

// ---------------------------------------------------------------------------
void FsSort() {
// --------------
sfl.clear();
// --------------
file_set::iterator i;
// --------------
sfl.push_back(&*i);
// --------------

// --------------
sort(sfl.begin(), sfl.end(), FsSorter);
// --------------
}

OutPut: Error

// ---------------- ERROR [bcc32 Error] ClFile.cpp(557): E2285 Could not find a match for 'sort<_RanIt,_Pr>(_Vector_iterator

,_Vector_iterator >,void)' Full parser context ClFile.cpp(533): parsing: void _fastcall CLSFILE::FsSort()
Error Line:

sort(sfl.begin(), sfl.end(), FsSorter);
Please give your ideas

Last edited on
The call to sort() is not inside any function. When I add typedefs for u64, u32, u16 & u8, and put the call to sort() inside main(), it complies in cygwin for me.
closed account (E0p9LyTq)
PLEASE use code tags, it makes reading your code MUCH easier.

http://www.cplusplus.com/articles/jEywvCM9/

Hint: you can edit your post and add the code tags.
Topic archived. No new replies allowed.