| |
| |
| |
|
Page: 1 2 3 4 5 6
Comments:
<0> it's lunch time <0> w00t <1> [1] would be otherstuff <2> by the way, bealtine <3> well oncey ou apply [] you're within Type's operator= <2> in that BaseArray, you can p*** Size to the vector constructor in the init list, instead of calling resize() <1> thats a typo <3> bealtine who are you talkign to, me or rd <1> i just want to push_back /***ign <3> your operator is for Array = stuff; not Array[1] = stuff; <1> ah ha <3> oncey ou apply [] <3> you are within Type's operator= <3> what I think you want is the += operator <4> even if you array[1]++ ? <4> that's still operator=?
<3> then you can do Array += stuff; Array += OtherStuff; <2> weird <3> NineVolt in this example. Don't be annoying <1> not intereste in Array = <1> just the elements <4> i tuned in late, wasn't trying to troll :P <3> oh heh ok <4> heh <3> bealtine yea I ***ume you're not interested in that :P are you trying to use Array[1] and Array[2] etc <2> bealtine why is a vector unsuitable? <3> without worrying about whether or not that item exists yet? <3> instead of calling Array.push_back(stuff); Array.pushback(otherstuff): ? <3> wow, typos are fun <2> int a[4]; a[1] = 3; a[2] = 7; vector<int> a(4); a[1] = 3; a[2] = 7; <3> rdragon I think he wants that exact example, but without doing a(4); and instead just using the default c-tor <1> yep <3> so if that array item doesn't exist, it generates it? <1> yes <3> bealtine if that's the case, you must call resize within your [] operator and then you do'nt need the = operator <3> though I do'nt recommend that method <1> sort of <1> Array[1] = stuuf does a Array.push_back <3> bealtine what does Array[1] = otherstuff; do ? <1> (stuff) <3> push back ANOTHER element? even though you just used the same index? <1> same <2> this is oddly strange, bealtine ;) <1> irrelevant :) <3> this is really really strange hehe <2> you always want [] to push_back ? <2> no matter the index? <3> sounds that way <1> just dont want to run through acres of code changing Array[X] = stuff <1> to Array.push_back(stuff) <2> you don't have to <2> ohh <2> well, you shouldn't have to <2> just change the array declaration <2> from int a[4]; to vector<int> a(4); <3> bealtine: Type& operator[](const int& i) { if(i >= size()) resize(i + 1); return at(i); } <3> beal: pseudo code <3> but if you do that you do'nt NEED to push back... when you access [] it will grow the vector to be a size capable of storing your new length <3> I think you are overloading at the wrong spot <1> possibly <1> probably :) <3> heh <2> bealtine - why not what I said? <3> if you use a method like I just posted, you will not need to overload any operator except []. However, it's kind of silly still <3> everytime you access an element it wil lresize, so it's wasteful <3> [11:39] <2> just change the array declaration <-- better solution <1> the code builds arrays out of chunks of data <2> so, it still must allocate the space ahead of time <1> yes <2> right <2> ? <2> ok <2> so give the vector an initial size <2> bam <2> and all should be fine... ?
<1> but i need to know the pos of the current push_back at any time <2> i guess we should look at the code you have existing <1> not the size <2> because this doesn't quite make sense ;) <1> it was based around boost::array <2> lets see how it's 'building' <2> well boost::array has an initial size, too <1> exactly which is where it fell down <2> im not sure why you know the size, but still want to push_back <1> i could tell how many elems where in there <1> could/couldnt <2> oh well shower/work time... good luck <1> same with vector <1> resize()/.size() pair only give you whatever size() was given <1> if you follow <2> i'd like to see this code that 'builds' the array <2> to figure out what you're trying to plug this into <1> ok <1> some stuff on noidea <2> ok so uh <2> i dont see the problem <2> unless you don't know the final size <1> exactly <2> you keep that 'running index' external <2> ...exactly what? <1> i dont know the size because variable length data gets appended to the arrasy <2> oh, well there ya go <5> hey guys <5> what's up? <2> bealtine if the statements look pretty similar, maybe a regex can help you change the code to push_back <2> but that's the way I would go, instead of inventing some weird sorta-container <2> gotta run though, good luck <1> ciao <5> I'm somewhat new to regexp, and I need to do a grep/substitution using a PCRE module. Can I do string substitution and grep matching at the same time? <5> That is, I'm trying to do "this is foobar" -> "this is bad" using something like ".*/foobar/bad/" <4> s/foobar/bad/ <4> CL : that's just retarded. <4> but as though being retarded wasn't bad enough, that wasn't even english. <6> =)) <6> you are a boot ....:D <4> a constant velocity joint boot at that. <0> good god bealtine sux0rs <7> hi all <7> I have an error in my code that says the functions in my header are being included in my project twice by two different dialog cl***es <8> /work <3> lies <7> lies!!! <7> hi vaw <7> hi all <7> I need to make it so that my header file doesn't get included in my project more than once <7> I think it has to do with the fact that I do #include at several different levels in my project <1> lookup header guards <7> ok <7> I used #if !defined Functions_h <7> then #define Functions_h <7> I will try #ifndef when I get home but that should have worked <9> you can also use #pragma once <10> http://www.theagitator.com/archives/026579.php#026579 <3> lol <3> nice article NI <0> well, found a bug in SOS <0> !clrstack appears to have an infinite loop bug in it's stalk walk <11> hello <11> can someone help me abaut: want to know how can i delete something from my all comp one program, datebase <7> yeah I didn't use pragma on mine, thanks I'll try it <0> keeps walking the same frame over and over <3> IkBe I have no idea waht you just said. try that one again <4> anyone here have any experience with bittorrent? <11> ? <11> ok <11> [m]aniac: i mean , how can i delete something (program/file) from my all comp , i don't want to be noone of parts <12> hola
Return to
#c++ or Go to some related
logs:
gentoo fglrx firegl_init_module firegl_stub_register
scoutmd ntohs dev-c++ #linux #mirc #linux /mnt/floppy incorrect super block
#linux gentoo Error: Failed to import module 'portage_db_cdb.database' a8n-e sata scsi boot
|
|