Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » Segmentation Error, Assertion failed BiCont.h
Re: Segmentation Error, Assertion failed BiCont.h [message #52725 is a reply to message #52724] Thu, 14 November 2019 11:39 Go to previous messageGo to previous message
Oblivion is currently offline  Oblivion
Messages: 1093
Registered: August 2007
Senior Contributor
Hello Xemuth,


Quote:

hat head method is used for ? do it concern only Vector or Array use it aswell ?


BiVector and BiArray are basically "bidirectional containers" that can act like queues (FIFO or LIFO). Smile

A head is basically the first element of that queue (BArray or BiVector). The same as vector[0];
A tail is basically the last element of that queue (BiArray or BiVector). the same as vector[vector.GetCount() - 1];

Api docs explain BiVectors and BiArrays. Here is an excerpt:

They "allows adding elements at both sides of sequence in constant amortized time."


T&       Head()                  { ASSERT(items > 0); return vector[start]; }


This means that your code is calling the Head method of a BiVector or BiArray in somewhere in your code, but the container appears to be empty at the time of call. Hence the assertion. Smile

Can you confirm my point of view : Upp calling Head before Doing any action on a Vector that could raise a crash ?


Probably. Because, as I pointed out above, the assertion you've got is a result of calling the Head method of an empty container.

Have you some tips and trick to do propper code and prevent all this Boards effect that can be raised by a bad usage of Vector ? 


Bounds checking or using IsEmpty() method, where appropriate, can save your time. Smile
Also check those containers whether they are picked or not. (Calling the Head method of a picked vector is illegal).


Best regards,
Oblivion


[Updated on: Thu, 14 November 2019 11:54]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How I can load inside Utimate++ RayLib For MacOs And Win?
Next Topic: [SOLVED] Do Value can store anonymous function ?
Goto Forum:
  


Current Time: Fri May 03 22:45:58 CEST 2024

Total time taken to generate the page: 0.02614 seconds