Help Logs Database

Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Ircnet  |  Dalnet
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30

<KimmoA> They make me wanna sleep...
<KimmoA> Stupid, boring...
<berty> you're reading the wrong books
<KimmoA> Books? BOOKS?! Who said anything about books? :)
<NKD> Star Wars isnt really sci-fi imho. Its got a sci-fi setting but the stories are cl***ic Fantasy plots
<KimmoA> I find them silly...
<kawfee> NKD: like the one about having *** with an alien?
<KimmoA> The special effects were awsome for such old movies, though.
<NKD> For example lets take the original trilogy
<KimmoA> And the music. And the intro.
<NKD> You have the Princess
<KimmoA> But I just can't take the story seriously.
<NKD> the old wizard (Obi wan)
<NKD> the young boy who would be a hero (Luke)
<NKD> the evil dark knight with a secret (Vader)
<NKD> and his evil master, the Emperor.
<NKD> You can just imagnie the Death Star being a regular old castle
<NKD> or an oppressive fortress on the outskirts of the "good" lands
<NKD> Take away the technology and you essentially have the same exact movie
<NKD> Cant say that about most sci-fi.
<kawfee> NKD: the technology adds spice
<kawfee> NKD: you could say the same thing about star trek.
<kawfee> One could say that star trek is just a set of adventures with technology.
<kawfee> like adventures that knights would take
<kawfee> travelling to another planet it like travelling to a far away land
<NKD> But so much of star trek is about the perils of new technologies, and how they are used and abused
<kawfee> such is life
<Vova> would any one have some time to ***ist me with a beginner code i cant get to work?
<YUY0x7> read topic
<kawfee> http://www.theregister.co.uk/2005/10/04/riaa_sued/
<NKD> Oh nice!
<NKD> Go soccer mom!
<Vova> im getting an error with the + overload in the this cl***
<Vova> http://rafb.net/paste/results/2HRXRz32.html
<Vova> it does nothing..but it cant even get the two lines to work
<job> i see
<job> you have to return a reference to yourself
<job> not an object
<job> Polynomial operator+(const Term &);
<job> should be
<job> Polynomial& operator+(const Term &);
<job> that way you can chain expressions like a + b + c
<job> wait
<job> wtf am i talking about
<job> rofl
<job> ignore me
<job> my brain isn't in gear
<job> i'm thinking of << or something
<Vova> no you have a point
<Vova> Prety much i want to be able to say
<job> no
<Vova> Polynomial P=Poly2+SomeTerm1+SomeTerm2+SomeTerm3
<job> ignore what i said completely
<Vova> im just getting this error
<Vova> :polycalcV0.4 error LNK2019: unresolved external symbol "public: __thiscall Polynomial::Polynomial(cl*** Polynomial const &)" (??0Polynomial@@QAE@ABV0@@Z) referenced in function "public: cl*** Polynomial __thiscall Polynomial::operator+(cl*** Term const &)" (??HPolynomial@@QAE?AV0@ABVTerm@@@Z)
<Vova> if i comment out the function it disappears
<Return0> I'm trying to make a matrix cl*** that supports both row-major and column-major indexing. The problem is if I have cm A * rm B, do I return cm (A*B), or rm(A*B) ... this gets weird because rm( cm(A*B) ) == rm (B*A) which is bad :P
<Return0> and it works the same way going from rm to cm
<Return0> so I can't ***ume the matrices are all one format and convert to the other later.
<Fogg> hi
<Fogg> i have a question concerning deques: if I have this - std::deque<int *> arrays; - a deque of arrays, when writing arrays.erase(arrays.begin()); for example, is only the pointer on the first position of the deque deleted, or is the entire array deque[0] deleted, using a delete[] statement ?
<MachinShi> yu're storing a pointer to an arra in the deque<int*> ?
<Fogg> yes
<MachinShi> it's not gonna delete the entire array. it'll just remove the pointe rin the deque.
<C--> is there a contant for NULL in C++?
<MachinShi> so fi that's the only link the array you ahve, it'd be a memleak
<C--> constant
<MachinShi> const int NULL = 0 ; //:P
<C--> I was wondering if it was defined in the STL or something
<MachinShi> nope..
<job> only the pointer is removed
<MachinShi> i'm hoping the nullptr concept is accepted to the next standard though
<Fogg> so i need to write - delete[] arrays[0]; arrays.erase(arrays.begin()); ?
<job> when's the latest standard coming out, has anyone got any ideas?
<job> you can't do [0] on a deque can you?
<job> .front() or something isn't it?
<Fogg> you can, it is a combination of a vector + queue
<job> but yes that's what you need to do
<job> ah
<Fogg> ok thanks for your help
<bobbyz> It has been a really long time since I've done any C programming and I can't remember how to copy an integer array. Is it strcpy I use to do this or something else?
<job> not strcpy!
<job> i suppose memcpy or something, though i'm not sure myself
<job> strcpy will stop as soon as it finds a null, which is bad
<bobbyz> oh
<Fogg> is memcpy copying the contents from a memory are to the other using 32 bits or 16 ?
<job> it's all just void* i think
<job> just make sure you calculate the sizes correctly and you're ok
<job> http://www.cplusplus.com/ref/cstring/memcpy.html
<job> so something like
<job> int* array1; // size 100 let's say
<job> int* array2;
<YUY0x7> std::copy(myarray1, myarray1 + size, myarray2); // ***uming myarray2 has at least size elements
<job> he was asking for C
<YUY0x7> go to #C then
<job> so my example would be... memcpy(array2, array1, sizeof(int) * 100);
<rain````> memcpy copies bytes but i wouldnt be surprised if it copied it by integer if it could during implementation
<job> might need to cast to void*
<rain````> job: that will copy 100 ints
<job> yes
<job> he said an integer array
<job> i just ***umed a size of 100
<rain````> k
<rain````> is there anyway to use variable argument lists
<rain````> but know the # of arguments?
<rain````> :P
<rain````> (non-platform/compiler specific anyway)
<YUY0x7> you can't with varargs?
<rain````> hmm
<rain````> a count
<rain````> say i have int foo(int *ptr, ...);
<rain````> and i call
<rain````> foo(&myInt,1,2,3,4,5,6,7,8,9,11,1,2,3,4);
<job> i've *never* used varargs actually, heh
<rain````> is there anyway to say "ok theres 14 extra arguments"
<rain````> without making it
<YUY0x7> to say to whom?
<Kniht> rain````: you have to give information about the varargs in one of the other parameters
<rain````> int foo(int num, int *ptr, ...);
<Kniht> rain````: what you can do is overload an operator, and get an effect like foo << 1 << 2 << 3
<Madsy_> ... can only be used for strings, with va_list, afaik.
<Madsy_> Or am I wrong? :)
<Kniht> rain````: or store them in a container (esp. if they're the same type) and p*** an iterator range
<rain````> heh, no gaurantee they are same type :P
<Kniht> Madsy_: you can use any other parameter type, but you must have at least one non-vararg parameter
<Kniht> rain````: one sec
<rain````> i've always wanted to know if there was a way to tell # of arguments :P
<SRdJAN> @find c++
<rain````> cuz int max(1,2,3,4,5,1,2,3) returning 5 and max(1,3,1,4,5) returning 5 and max("abc","def","ghi") returning "ghi" would be mmmm good
<Kniht> rain````: i wrote this to ***ign to members, but you can expand it to call a function
<Kniht> http://qxxy.com/people/roger/2005/10/02/builder.cpp
<Madsy_> rain````: ...funky
<Kniht> rain````: just stick them in a container and use max_element, if they can vary use a variant type (there's boost::any if nothing else) and specify your comparator
<Kniht> rain````: the most useful versions have the same type, like all of your examples
<rain````> well
<rain````> what about function pointers too
<rain````> cant leave them out!
<Kniht> what about them?
<rain````> p*** em to a variable length function
<rain````> i.e.
<Kniht> i don't see how that is related to what you were asking
<rain````> int add2(int i) { return i+2 } int square(int i) { return i*i } foo(i, add2, square, add2, add2, square);
<Kniht> stick them in a container and use for_each, or use boost::lambda
<rain````> :P
<rain````> ur no fun
<rain````> so theres no way to tell # of arguments
<rain````> is there
<Kniht> i already answered that
<rain````> no u didnt
<Kniht> 13:18:18 @Kniht> rain````: you have to give information about the varargs in one of the other parameters
<rain````> u said i have to do something else :P


Return to c++
or
Go to some related logs:

Tiga_You_Gonna_Want_Me_High.mov
manadens_bilagare

Copyright © 2005 www.irclogs.ws. All rights reserved. » disclaimer » contact