Sign in to follow this  

std::vectors, can be answered in 2 seconds

This topic is 4388 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Guest Anonymous Poster
Quote:
Original post by Sneftel
NO! end() points after the last element. MYVEC.back() == x, though.


* 2...

Seriously, I'm not joking, when you multiply that by 2 you get NO!NO!.

Anyways, YOURVEC.end() is 1 past the end, not the back. '.back()' as sneftel said, would work.

C++

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
[quote]Original post by Trillian
Hello

I have a little question about vectors:
if I do
MYVEC.push_back(x); <

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
[quote]Original post by Anonymous Poster
[quote]Original post by Trillian
Hello

I have a little question about vectors:
if I do
MYVEC.push_back(x); <

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
WTF?

WHATS HAPPENNING TO MY STUPID POSTS!!!!!!!

I MEANT, WHY ARE YOU USING A NON POINTER AND LATER A POINTER?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by Sneftel
He was dereferencing the iterator returned by end().


Ohh.... Gotcha. That's when '(' and ')' kick in lol:

//pointer
(*pVec).end();

//dereferencing
*(Vec.end());

Share this post


Link to post
Share on other sites

This topic is 4388 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this