I've been creating my own vector class as a learning experience and also because I wanted something a little more versatile for me than std::vector.
It works perfectly well for pretty much everything I've tried. However I'm trying to read from a text file and split strings up that I push into my custom vector like so:
If I replace it with an std::vector, it works just like I would expect it to, however with my custom vector, when it prints, the ouptut is garbled, and when my vector goes out of scope (when the while loop continues) it crashes in my vector's destructor. Which here's the full code to my custom vector class:
I'm aware my vector class could be a bit neater, but I'm putting functionality first here. I just don't understand why when I'm deleting the vector's element array, it crashes, but only in this instance. I haven't had an issue with any other data type.
As per the contents of the file I'm reading, it's incredibly simple, but I'll pastebin it here:
Is there something special about std::strings? It only seems to happen if I do it with this. So what gives? Any help is greatly appreciated.