Hello, When this code executes it is throwing an error stating "An invalid parameter was passed to a function that considers invalid parameters fatal." What could be causing this? In the debugger it breaks at the closing curly brace so everything within the function should have executed successfully. Any Ideas?
There may be two things that happen at the closing curly brace. For sure, the argument that was passed in by value is destroyed. And, depending on how the compiler handles it, a copy of *this may be constructed.
From some of the other results googled, I suspect the exception will be triggered by the destructor although the cause is likely to be tied up in the tasks somewhere.
This is a semantically surprising signature for an operator= overload.
I noticed that I had not written a destructor for the chunk class, so I made a blank destructor quickly. Now I am still getting the same error, but it is on the closing brace of the chunk destructor. Why is the error moving around?
It's not. Those two places are conceptually the same, it's just that in one the destructor is implicit so there is no definition to jump to and in the other the destructor is explicit so there is a definition to jump to.
I narrowed it down to this piece of SFML code:
What steps did you take to "narrow it down" to that code?
> But I am passing in the exact argument it asks for! (Vector2f)
failing to provide the correct type would cause a compile-time error.
you said that the error you were getting was a run-time error. For example, it may be caused by a null pointer or one that doesn't point to dynamically allocated memory.