Advertisement

Trouble with Dynamic array implementation

Started by December 02, 2016 08:09 PM
10 comments, last by Khatharr 8 years ago

Ok, finally got the Vector thing figured out. You were right about not using "at()", simply replacing every occurrence of it with "vertices[n]" did the trick, and it's working fine now.


That mildly surprises me, but I'm not intimately familiar with the semantics of .at() since I have never once used it in 20 years. :)

works quite well. Despite that, is there a reason I should use another format? Just asking because you said not to use the "&vertices[0]" idiom. Not quite sure what you meant by that. Removing the ampersand, or the "[0]" reference causes a crash.


Like I said, use .data() instead. Replace &indices[0] with indices.data()

Regarding this, I think EASTL had a member function for getting the byte length of a vector. Are you aware of any talk about upgrades to std::vector along these lines? I was disappointed recently to find that there doesn't appear to be a standard way to refer to a vector's type that works with sizeof(). I was thinking that sizeof(vec.value_type) was possible until I tried it.


I have an extremely vague recollection of it being discussed on the main isocpp reflector a while ago, but I don't recall an actual paper being submitted.

Quite possibly worth bringing up on the c++ sg14 reflector. *nudge* :)

Sean Middleditch – Game Systems Engineer – Join my team!

I'm about to be conscripted for some housework, but I'll see what I can do later. I was looking at it yesterday and apparently there's a workaround at present in the form of sizeof(decltype(vec)::value_type), so in theory it shouldn't be too difficult to work out something more convenient.

Edit: Posted.

void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.

This topic is closed to new replies.

Advertisement