divinepet/ft_containers-unit-test

some problems

Opened this issue · 2 comments

Hi! Amazing test but here are some issues.

  1. Set erase(val):55 line. I think this is undefined to do post decrement on empty set iterator. To see it, try run with -g -fsanitize=address. My tree, which is almost same as stl2.03 has SEGV here, this really weird that my macOS STL pass this fine.

  2. Testing capacity in vector seems to be not quite correct, since we not required do accurate copy of std vector for particular implementation on particular machine.

  3. Also im faced with interesting things that my iterator in vector (which is just raw pointer ), not supports ++vect.begin() operation. And referring to ISO98 standard it doesn't have to. Maybe im a little wrong in implementation, but still has no solution for this. I think it's better to keep this problem to involve more people

Thank you for this great tests! It helped me a lot.

@tonypony220
Thank you for your feedback!

  1. Fixed. We did the same for map a week ago.
  2. Could you please to tell more about it?
  3. vector.begin() should return iterator unlike vector.front(). And then there's a simple pre-increment, that must be implemented in your own iterator class

Number 3 was very helpful for me. I got the same error and it was because I was using pointers instead of re-implement a vector class.