Click here to Skip to main content
15,436,734 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Change LVS_ALIGNLEFT by LVS_ALIGNTOP Pin
_Flaviu1-Oct-14 21:53
Member_Flaviu1-Oct-14 21:53 
Questionkuch ni milya..... Pin
Member 1111991229-Sep-14 22:52
MemberMember 1111991229-Sep-14 22:52 
QuestionFunction in namespace - multiple definition Pin
elelont229-Sep-14 21:21
Memberelelont229-Sep-14 21:21 
QuestionRe: Function in namespace - multiple definition Pin
Richard MacCutchan29-Sep-14 21:28
mveRichard MacCutchan29-Sep-14 21:28 
AnswerRe: Function in namespace - multiple definition Pin
elelont229-Sep-14 21:35
Memberelelont229-Sep-14 21:35 
GeneralRe: Function in namespace - multiple definition Pin
Richard MacCutchan29-Sep-14 21:58
mveRichard MacCutchan29-Sep-14 21:58 
AnswerRe: Function in namespace - multiple definition Pin
Albert Holguin30-Sep-14 2:43
professionalAlbert Holguin30-Sep-14 2:43 
QuestionVector Iterator Incompatible Pin
mjackson1129-Sep-14 10:07
Membermjackson1129-Sep-14 10:07 
I am getting a run time error with the code below. Trying to use a static iterator to reduce the number of calls to search a vector.

This is a method of a class that contains a vector of curves (so _vector is part of the class.)

It runs correctly the first few times called, but the first time the static iterator doesn't point to the correct curve and _vector should be searched, I get a runtime error "Incompatible Vector Iterators" calling the == operator.

I can't really tell what the error is. If it is a const versus non-const or it is creating copies of the vector somewhere.

Is there a better way to do this?

Thanks

Mark
C++
bool findpt(pt_tag<_Ty>* s)
{
    if (_vector.empty())
        return false;

    static vector< curve<_Ty> >::iterator i = _vector.end();

    if (i == _vector.end())  <-- RUN TIME ERROR HERE

        i = std::lower_bound( _vector.begin(), _vector.end(), s->_dtEffDate );
    else {
        if ((i._Ptr->getdate() != s->_dtEffDate))
            i = std::lower_bound( _vector.begin(), _vector.end(), s->_dtEffDate );
    }

    if ((i == _vector.end()) || (s->_dtEffDate != (*i)._date))
        return false;

    cpoint<_Ty> c;

    c.setdate( s->_dtFwdDate );

    if (i._Ptr->interpolate( &c ) == true) {
        s->_valid = true;
        s->_value = c.getvalue();
        return true;
    }
    return false;
}

AnswerRe: Vector Iterator Incompatible Pin
Chris Losinger29-Sep-14 10:20
professionalChris Losinger29-Sep-14 10:20 
GeneralRe: Vector Iterator Incompatible Pin
mjackson1129-Sep-14 12:10
Membermjackson1129-Sep-14 12:10 
QuestionFormview scroll problem Pin
john563229-Sep-14 2:45
Memberjohn563229-Sep-14 2:45 
QuestionSocket Programming(UDP) Pin
A_Fa28-Sep-14 20:48
MemberA_Fa28-Sep-14 20:48 
AnswerRe: Socket Programming(UDP) Pin
Richard MacCutchan28-Sep-14 22:02
mveRichard MacCutchan28-Sep-14 22:02 
GeneralRe: Socket Programming(UDP) Pin
A_Fa28-Sep-14 22:17
MemberA_Fa28-Sep-14 22:17 
GeneralRe: Socket Programming(UDP) Pin
Richard MacCutchan28-Sep-14 22:30
mveRichard MacCutchan28-Sep-14 22:30 
Questionmatrix svd decomposition problem Pin
includeh1028-Sep-14 11:29
Memberincludeh1028-Sep-14 11:29 
AnswerRe: matrix svd decomposition problem Pin
Richard MacCutchan28-Sep-14 22:01
mveRichard MacCutchan28-Sep-14 22:01 
AnswerRe: matrix svd decomposition problem Pin
CPallini28-Sep-14 22:01
mveCPallini28-Sep-14 22:01 
GeneralRe: matrix svd decomposition problem Pin
includeh1029-Sep-14 4:17
Memberincludeh1029-Sep-14 4:17 
GeneralRe: matrix svd decomposition problem Pin
CPallini29-Sep-14 5:17
mveCPallini29-Sep-14 5:17 
QuestionWill casting / passing 16 bit int as double harm FFT processing? Pin
Vaclav_27-Sep-14 6:33
MemberVaclav_27-Sep-14 6:33 
AnswerRe: Will casting / passing 16 bit int as double harm FFT processing? Pin
Rick York27-Sep-14 8:02
mveRick York27-Sep-14 8:02 
GeneralRe: Will casting / passing 16 bit int as double harm FFT processing? Pin
Vaclav_27-Sep-14 9:05
MemberVaclav_27-Sep-14 9:05 
AnswerRe: Will casting / passing 16 bit int as double harm FFT processing? Pin
Richard MacCutchan27-Sep-14 22:07
mveRichard MacCutchan27-Sep-14 22:07 
GeneralRe: Will casting / passing 16 bit int as double harm FFT processing? Pin
Vaclav_28-Sep-14 4:18
MemberVaclav_28-Sep-14 4:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.