@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14



Comments:

<0> that would be useful
<1> any -n and +n stuff used in indexing an array is a red flag for underrun/overrun
<2> yay chinese food
<2> pwn pwn pwn
<0> ah
<3> lain_prolian the 'proper' way would have been to use std::remove_if
<1> how would you right the predicate?
<1> write too
<3> it would also be logical to simply not write whitespace to the beginning of the line
<1> I would simply write my own trim_left, trim, and trim_right functions if I needed to do this often.
<0> oh
<0> std::remove_if is sort of neat
<3> Twister76: use std::isspace
<2> there's also std::copy_if
<0> but isn't that for vectors?
<2> if you want to make a copy



<4> People who create things nowadays can expect to be prosecuted by highly moralistic people who are incapable of creating anything. There is no way to measure the chilling effect on innovation that results from the threats of taxation, regulation and prosecution against anything that succeeds. We'll never know how many ideas our government has aborted in the name protecting us. Joseph Sobran May 13, 1998 (commenting on US vs Microsoft)
<2> ok, food time
<2> mmm
<3> mmm, asian food
<1> yes, but you use static vars to mark first char?
<2> mmm, asian girls
<1> or what?
<2> HUHUHU
<0> lol i am not sure
<0> so i should avoid A[n+-1]
<3> Twister76 - you could use std::find_first_not_of to find the first non-whitespace
<0> i will try to do that from now on
<1> yeah.
<0> instead i should run conditional tests on the object i am processing to be sure that the process is valid for it?
<0> like, whether it has enough elements or not to work in the algorithm?
<3> no, you just use iterators to specify the range
<3> if that range happens to be 0, then nothing is done
<1> so bascially store an iterator of first and last char, copy it into another string, and return it or swap it into a reference
<5> so I want all the text from a line of a file but not any whitespace after the text ... how can I get this?
<5> get line will get even the white space of course
<3> BDPE why is there white space before/after the text?
<3> what is this 'text' that you're reading?
<5> only after ...
<0> maybe he's parsing a script or something
<5> the why doesn't concern me ... that's how the file is structured and I am trying to parse it
<3> maybe he's doing any one of a billion things
<3> BDPE it'd help to know exactly what's in the file
<5> for instance one line might say:
<3> does each line follow a specific format?
<5> asdf jk;
<5> no specific format at all
<3> is the last character always ; ?
<5> no uniformity whatsoever
<3> what is it?
<3> a story?
<6> what is the ansi way to convert integer to char* string? (itoa is not ansi)
<5> it really doesn't matter rdragon
<0> maybe its some kind of encrypted code
<3> lonetron why would you want to convert to char* ?
<0> sprintf(str, "%d", integer);
<6> thx
<0> that works...
<3> lain_prolian this isn't #C, prefer something more C++-like
<0> oh
<0> sorrie :(
<3> std::stringstream ss; ss << some_int; std::string s = ss.str();
<3> or std::string s = boost::lexical_cast<std::string>( some_int );
<0> boost?
<0> sorrie rdragon
<0> i am not a professional C++ programmer
<3> BDPE if you really have just text lines, after you read the string, erase everything from the last non-whitespace character to the end
<0> i don't mean to confuse anyone with Cish syntax sometimes
<0> i will try to avoid it when posting here
<3> lain_prolian then be hesitant about giving advice ;)
<0> :(
<0> i do that all of the time though
<0> it does work, whether it is C++-like or not
<3> nobody cares if it "works"
<3> programming isn't about 'making it work'
<3> at least, not the kind of programming around here
<1> well, its partially about ... ;)



<0> now i feel bad :(
<0> lol
<0> i guess i got into C because i interface with the win32 API in alot of my programs
<0> and it makes heavy use of C type syntax
<1> you can interface it rather well with pure c++, then only switch to LPCSTR, etc when absolutely necessary.
<0> true
<0> string::c_str( ); lol
<0> :P
<1> but usually its only temp c-style strings.
<0> reading and writing files with Win32 api involves character buffers and such though
<0> pipes and sockets and such
<0> lol
<0> i guess rdragon doesn't like me very much then :(
<0> i am sorrie rdragon
<7> is there a way with templates to have some code present or not depending on the data types used for the function?
<0> hmm
<1> thats polymorphism
<0> you can have functions of the same name with different prototypes
<3> lain_prolian it's fine
<0> :) okie
<3> ViPr can you be more specific?
<3> ViPr you can choose to not define the generic version, and only define the specializations you wish to support
<3> but why?
<1> ah yeah, I misread the question again... I got to get better at seeing what is there vs what I expect to see.
<0> lol
<0> i have a bad habit of doing that too
<0> rdragon hopefully uni will teach me to write programs that are more C++ centric
<3> don't count on it
<0> you don't think that uni will?
<7> well i made a use lookup table function and it needs to do scale and bias on the data if it's stored as integer but not if it's stored as real numbers
<1> well, you can just have two functions with two different prototypes, unless you plan on adding other data types.
<7> i'm getting sick of copy pasting the same code everywhere
<1> then don't...
<1> you can make the calculations portion one function, and do the bias in another
<1> e.g. p*** in the scale and bias parameters based on the input type
<1> or if you need a lot of functionality, use a functor like object.
<7> i need to find a way to make the compiler write various functions from 1 function
<8> ViPr: You're in luck. That sounds like what templates do.
<7> it's called metaprogramming. writing programs that write programs.
<7> i need to learn that
<8> Well, learn C++ templates, and you will.
<7> because my use_lookup functions are getting ridiculous. they are all basically identical with small variations between them for like if the they use 3 channels or 4 channels or 1 channel or whatever channels or are looping or non-looping or are 1 dimensional or 2 dimensional. it's ridiculous
<7> i have so many functions now coz i don't want to write 1 function with lots of if statements in it coz that would make it too slow
<1> you still need the conditions to decide which function to call...
<1> sounds like you need some objects.
<1> the object will keep track of the states
<8> Twister76: How can you tell he needs conditionals?
<1> well, how else would you know if you need one, 2, n channels, looping , non-looping, etc?
<1> I guess I did make an ***umption that was run-time determined
<8> Twister76: Template arguments and specialization?
<1> Yes, but that only solves part of the problem from what I am gathering. Maybe I am making a false ***umtion though.
<1> from what I am gathering, the design needs to be more modular.
<8> I just came in. I might have missed something.
<1> ViPr, post an example of the replicated code
<1> then we can stop speculating.
<7> i'm going to have to write code that writes code
<7> oh boy
<1> well, post the current code and get some more opinions
<1> like jbatista said, templates do that.
<7> i don't think templates do that
<1> meta programming is not super popular in lookup functions as far as I can figure.
<1> other than templates.
<7> ah forget this
<1> dang it, I am bored and wanted to see some code :)
<8> OMG, insipid piece of crap.
<8> OfficeScan just graciously volunteered to do me the service of deleting ophcrack from my machine.
<8> Without asking me.
<8> Fricking Trend.
<2> khadgar is up my ***
<2> won't connect
<7> it seems metaprogramming is exactly what i need but i got no clue how to do it or if it's possible with my compiler
<9> I am back!


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






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

virus repeating letters
no adaptors present linux xinfo
cajt malti
Dharshini David
#squid
tranxxx
#c++
rss2array enclosure
#london
bruneta30



Home  |  disclaimer  |  contact  |  submit quotes