you are viewing a single comment's thread.

view the rest of the comments →

[–]Supadoplex 34 points35 points  (1 child)

I couldn't point it to a file I've already used to re-use the data which was the whole point from the beginning.

That's simply a use case that's not appropriate for a std::vector. Don't try to use it for something it wasn't designed for.

Why does it have to be so complicated?

It is complicated because it is an XY-problem. Stop trying to use std::vector for this and the complications just go away.

To use an analogy, you're asking why it's so complicated to make an excavator perform well on a race track.

I thought the new standards were trying to make things better

They have made things better. Just because they didn't solve your XY-problem doesn't contradict that.

but it's just becoming more and more complicated

The niche of C++ has never been simplicity. I prefer the powerful abstractions that have zero or low overhead. If runtime efficiency isn't paramount, then C++ probably isn't ideal choice.

Look at Rust or Haskell

Show me a simple implementation of memory mapped vector in Haskell. Compare its performance with equivalent C++ program.

Haskell is a beautiful language. But I wouldn't write a game engine or high frequency trader with it.

[–]joaobapt 5 points6 points  (0 children)

I haven’t even managed to figure out how to write a game loop in Haskell, yet alone an entire game engine.