-
March 12th, 2014, 08:59 AM
#16
Re: Debug Assertion Failed! due to the use of ifstream
Originally Posted by 2kaud
In calcPayFixes, there are several lines of code like this
Code:
if (cnt <= payDates_.size())
Are you sure this test should be <= and not < as the elements of the vector go from 0 to .size() -1?
To be honnest, I cannot say since the whole code does not come from me. But I still working on this matter.
Last edited by eBooster; March 12th, 2014 at 09:17 AM.
-
March 12th, 2014, 09:18 AM
#17
Re: Debug Assertion Failed! due to the use of ifstream
Originally Posted by 2kaud
Possibly because of what I mentioned in my previous post #13.
I tried your advice in post #13 without success.
-
March 12th, 2014, 09:26 AM
#18
Re: Debug Assertion Failed! due to the use of ifstream
Originally Posted by eBooster
To be honnest, I cannot say since the whole code does not come from me. But I still working on this matter.
Are you sure that the parameters you are passing to the constructor of s are correct and valid?
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
March 12th, 2014, 10:26 AM
#19
Re: Debug Assertion Failed! due to the use of ifstream
Originally Posted by 2kaud
Are you sure that the parameters you are passing to the constructor of s are correct and valid?
Yes, I have checked this, but I think it come from the source you said in post #13.
Last edited by eBooster; March 12th, 2014 at 12:03 PM.
-
March 12th, 2014, 12:24 PM
#20
Re: Debug Assertion Failed! due to the use of ifstream
Originally Posted by 2kaud
In calcPayFixes, there are several lines of code like this
Code:
if (cnt <= payDates_.size())
Are you sure this test should be <= and not < as the elements of the vector go from 0 to .size() -1?
You were since very close : the bug came from the second line after the one you highlighted.
if (cnt <= payDates_.size())
{
if (cnt + payFrequency_ < payDates_.size()) //< instead of <=
-
March 12th, 2014, 02:46 PM
#21
Re: Debug Assertion Failed! due to the use of ifstream
I'm pleased you found the issue. I'm always very wary when I see <= relating to elements of a container.
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
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
|