-
November 1st, 2007, 12:13 PM
#1
[RESOLVED] Sequence not ordered
First I should state this program has been running for 3 years just fine and I am not sure what the reason is for it suddenly not working. I just got the new version of MSVC and installed the new BOOST so maybe that's the issue.
Any how, I have 2 vector stucts of mostly strings that I am trying to merge together using the meter number. The meter number can contain a mixture of characters, however they are sorted by SQL ASC before being put in the struct.
Example of the order:
S6642
10172
10296
10322
10804
10884-S
10923
Here is the code that was working but is now giving me the error that the sequence is not ordered. The error is with the lower_bound.
Code:
struct UT550_LESS
{
bool operator () (const UT550AP& lhs , const UT550AP& rhs)
{
return lhs.sMeterNumber < rhs.sMeterNumber;
}
};
....
//Loop List
for (_vec = m_vecUT553AP.begin(); _vec != m_vecUT553AP.end(); _vec++)
{
if((*_vec).sMeterNumber != "")
{
lm_tmp.sMeterNumber = (*_vec).sMeterNumber;
//--------------- PROBLEM BELOW ---------------
it = lower_bound(m_vecUT550AP.begin(), m_vecUT550AP.end(), lm_tmp, UT550_LESS());
if (it != m_vecUT550AP.end() && (*it).sMeterNumber == (*_vec).sMeterNumber)
{
Any help would be great. Thanks!
-
November 1st, 2007, 12:46 PM
#2
Re: Sequence not ordered
Got it working by using std::sort first.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|