i was trying to create a deque, and when the function that resizes the array is excuted, it crashes with the error from the title, and when i delete the deallocate() it stops happening, what im doing wrong? code: https://pastebin.com/0yHHcLnj

you are viewing a single comment's thread
view the rest of the comments
[–] [S] 1 point 2 years ago (1 child)

i used tthe tester class with my code removing the .deallocate(), and although it doesnt crash, it still runs the destructor multiple times on the same element, i think its because im just pushing i into the container, and because that constructor creates an implicit conversion between int and ContainerTester, it creates a temporary object that gets destroyed once it is pushed into the deque, am i right?

  • source
  • parent
  • hideshow 2 child comments
  • [–] 2 points 2 years ago* (last edited 2 years ago) (1 child)
    1. sorry that I let you down yesterday
    2. as an excuse, I have fixed and commented your code. (remember to compile it with -std=c++20)
  • source
  • parent
  • hideshow 2 child comments