V
Venthor
Hello,
I'm having some problems wrapping my head around what I need to do.
I'm using a vector to store an array of a specific class object full
of data.
class part_info
{
public:
string part_no;
string raw_qty;
int qty;
int ref;
part_info() : part_no(" "), raw_qty(" "), qty(0), ref(0) {}
part_info(string NewPartNo, string NewRawQty, int NewQty, int
NewRef) : part_no(NewPartNo), raw_qty(NewRawQty), qty(NewQty),
ref(NewRef) {}
};
.....
void setup {
NAMEVECTOR theVector;
NAMEVECTOR::iterator theIterator;
.....
//add a dataset to my vector
theVector.push_back(part_info(part_no,raw_qty,qty,ref));
}
When I'm finished adding my data to my vector I want to be able to
sort it by part_no.
I've looked at overriding the operator < and then using the std::sort,
but I'm getting compiling errors and while I understand the basic of
what is going on I must be missing something.
Could someone please help me with this?
Thanks
Venthor
typedef vector<part_info> NAMEVECTOR;
I'm having some problems wrapping my head around what I need to do.
I'm using a vector to store an array of a specific class object full
of data.
class part_info
{
public:
string part_no;
string raw_qty;
int qty;
int ref;
part_info() : part_no(" "), raw_qty(" "), qty(0), ref(0) {}
part_info(string NewPartNo, string NewRawQty, int NewQty, int
NewRef) : part_no(NewPartNo), raw_qty(NewRawQty), qty(NewQty),
ref(NewRef) {}
};
.....
void setup {
NAMEVECTOR theVector;
NAMEVECTOR::iterator theIterator;
.....
//add a dataset to my vector
theVector.push_back(part_info(part_no,raw_qty,qty,ref));
}
When I'm finished adding my data to my vector I want to be able to
sort it by part_no.
I've looked at overriding the operator < and then using the std::sort,
but I'm getting compiling errors and while I understand the basic of
what is going on I must be missing something.
Could someone please help me with this?
Thanks
Venthor
typedef vector<part_info> NAMEVECTOR;