« first day (23 days earlier)      last day (36 days later) » 

12:59 PM
Hey

Anyone know how I can solve an access violation when doing someVector.insert(someVector.begin() + index, Object);
 
Delete the line!
 
sbi
@KaareZ Yep.
 
@KaareZ Debugging often helps.
 
I can
I can't figure it out
 
Xeo
Think more.
 
1:01 PM
It works whenever I do it with .end() and without the index
@sbi
Do you have cue what could be wrong?
 
sbi
@KaareZ
 
@KaareZ Yes.
 
Well, nobody want to help?
 
@KaareZ You got that right
You could just try debugging it, Googling it or you know, ask on this website called Stack Overflow.
 
1:03 PM
There's also the C++ room :)
 
Ha, std::vector’s insert doesn’t take an integer? C++ is silly.
 
Ven
@RyanO'Hara what do you mean? To select where to insert it?
 
@Ven Yes
 
Ven
@RyanO'Hara x.begin()+3 (with insert) should work perfectly fine
 
@KaareZ Check that the index is in range before you do that, abort if not, fix the reason.
 
1:05 PM
std::next(std::begin(vec), 3)
 
in VB.NET it’s literally vec.Insert(x, 3)
 
I have reserved(8), and the index is 4
 
Xeo
capacity != size
 
@KaareZ either the begin() or the index are bad. Off-chance, a bug in the (copy) constructor of Object
 
47
A: std::vector::resize() vs. std::vector::reserve()

CashCowThere are two different methods for a reason: std::vector::reserve will allocate the memory but will not resize your vector, which will have a logical size the same as it was before. std::vector::resize will actually modify the size of your vector and will fill any space with objects in their d...

 
1:10 PM
29 messages moved from Lounge<C++>
 
Ooooh.
 
@Morwenn Mmm?
This room works pretty well if it's used. Let's just try to get it into the process
It would be a lot nicer if we could have moved the topic without the noise (my own included)
 
 
2 hours later…
2:58 PM
glad this room is gearing up
thx sehe
 

« first day (23 days earlier)      last day (36 days later) »