Anyway It seems to work fine it allocates space for everything.. But it does not put the value in.
I have tested the value one statement before it is passed as an argument to the function and yet when I test it afterwards all the values are zero. So I replaced it with the insert function and an iterator to the and it works. However i can't have that many function calls in my program so does anyone know what I am doing wrong. If I give the code and you find something else minor that is wrong with it just ignore it please and answer try to find this bug I am talking about perhaps if I forgot to put ; after a statement that is merely a copy error because this is a runtime problem not a compile time problem and any problem you spot in the code is unsignificant and probably a mistake I made while copying the code. If you need the code to figure out my problem please ask I will post it up.
Already I have tested the following conditions:

The value being zero was not due to the value being passed being = to zero.
Proof: I outputed the value right before the value was inserted then tested that value and it was still zero although the value passed was not.

The value is not zero because of some kind of error due to exceeding the vectors max capacity:
proof: If vectors even have such a thing which i have no idea even though I tested to make sure.. the problem had reached 256 capacity by the end of the loop yet not one of those values were assigned anything but a few junk values at the end. The vector was filled with 256 zeros even though i had filled it with many non-zero numbers.

Can anyone tell me what I am doing wrong, I am trying to use the push_back function thanks.

Recommended Answers

All 2 Replies

Can anyone tell me what I am doing wrong, I am trying to use the push_back function thanks.

Not without seeing the relevant portion of your code...

Hmm Ok I changed it back, I changed it to vector.push_back(value), from vector.insert(iter1, value) and it started working I wonder what was wrong with it... sometimes the standard string class does this and it won't output, then sometimes it starts working.. I have never resolved that issue I hope stl does not become like that for me 2.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.