Jun 5, 2018 at 7:34pm Jun 5, 2018 at 7:34pm UTC
Not sure I understand. A list is not a pointer. It cannot be null. It is initialized automatically when you create it on line 7.
Last edited on Jun 5, 2018 at 7:34pm Jun 5, 2018 at 7:34pm UTC
Jun 5, 2018 at 8:00pm Jun 5, 2018 at 8:00pm UTC
How do I assign elements to "m_WayPoints" then? So I can falsify the condition on line 13?
Jun 5, 2018 at 8:21pm Jun 5, 2018 at 8:21pm UTC
The std::list has members like empty() or size()
Normally you don't need to sice std::list throws an std::bad_alloc if the insert doesn't succeed.
Jun 18, 2018 at 6:59am Jun 18, 2018 at 6:59am UTC
An iterator is not a pointer. It cannot be null.
What you normally do for iterators is to set them equal to the end() iterator instead. The end() iterator refers to one-past-the-end, so it doesn't refer to any valid element. If you set curWaypoint to m_WayPoints.end() you could check for that inside the assert.
assert(curWaypoint != m_WayPoints.end());
Last edited on Jun 18, 2018 at 7:00am Jun 18, 2018 at 7:00am UTC
Jun 25, 2018 at 5:26am Jun 25, 2018 at 5:26am UTC
thank you Peter- problem solved