Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

C++ vector

Name: Anonymous 2007-09-22 6:52 ID:r16GJhP5

I have a class with two vectors.

I use a while loop to add things into both of them, both inside their own function

they add elements to the vector correct, but for some reason one of them empty itself after the function has ended, even though I did not tell it to.


why would a vector just delete itself randomly at the end of a function?

Name: Anonymous 2007-09-22 7:01 ID:ro1BfPrp

We can't spot your stupid mistake just by listening to your incomplete description.

Name: Anonymous 2007-09-22 9:16 ID:Heaven

It became self aware and then became an hero.

Name: Anonymous 2007-09-22 15:24 ID:Heaven

your lack of code disappoints us throroughly

Name: Anonymous 2007-09-22 17:05 ID:6A/TRXy9

HEY GUYS, I HAVE A PROGRAMMING QUESTION, MY CODE DOESNT WORK? WHY? THX FOR HELP

Name: Anonymous 2007-09-22 17:07 ID:mHUCpZlS

Maybe you just never put any elements into the second vector dipshit

Name: Anonymous 2007-09-22 17:32 ID:Heaven

>>6
More likely to be a scoping issue; the vector he wants to access are shadowed by something in a more local scope ganking the identifier. But who the fuck cares, let's read some SICP.

Name: Anonymous 2007-09-22 21:13 ID:5fvOQaM1

>>1
Add like this:

def AddToVector(self, n):
    self.vector = map(lambda x: x + n, self.vector)

Name: Anonymous 2007-09-23 2:15 ID:Qi2XqiDM

>>7
it probably was a scope problem. I fixed it about 10 seconds after i wrote this thread, for some reason it deleted the vector after the function ended. I just moved the code to another function and it worked

this means I could have a buffer overflow somewhere in my program. hopefully I'll find it soon :/

Name: Anonymous 2007-09-23 6:16 ID:kFAe9np+

>>9
I don't really know what I'm doing. I just moved some code around and it worked. Hopefully I won't have any other bugs.

FIXED

Name: Anonymous 2007-09-23 6:20 ID:XLEYkpIK

/r/ing ANGERED EXPERT PROGRAMMER copypasta for >>9

Name: Anonymous 2007-09-23 6:23 ID:hPrdejKS

>>9
OKAY YOU FUQIN ANGERED AN EXPERT PROGRAMMER
GODFUCKIGNDAMN
FIRST OF ALL, YOU DONT FUQIN KNOW WHAT A MAN PAGE IS
SECONDLY, THIS IS /prog/ DO NOT DEMAND USEFUL ANSWERS THE WAY YOU WANT THEM TO BE
THIRDLY PROGRAMMING IS ALL ABOUT PHILOSOPHY AND ``ABSTRACT BULLSHITE'' THAT YOU WILL NEVER COMPREHEND
AND FUQIN LASTLY, FUCK OFF WITH YOUR BULLSHYT
EVERYTHING HAS ALREADY BEEN ANSWERED IN >>8,11,12

Name: Anonymous 2007-09-23 10:57 ID:8nuwbLdM

>>9
Do you even know what you are saying?

You must be programming ENTERPRISE SOLUTIONS

Name: Anonymous 2007-09-23 11:05 ID:Heaven

>>13
Cretin;

It's ENTERPRISE SOLUTIONS, not ENTERPRISE SOLUTIONS.

Name: Anonymous 2007-09-23 11:06 ID:3Zd0WxsA

/r/ bold parenthesis angered programmer copypasta.

Name: Anonymous 2007-09-23 17:04 ID:Heaven

>>15
but that one is not funny. it's you who wrote it anyways.

Name: Anonymous 2010-11-13 15:47

Name: Anonymous 2011-02-04 18:16

Don't change these.
Name: Email:
Entire Thread Thread List