@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet
Page: 1 2 3 4 5



Comments:

<0> for*
<1> Pfloyd: Yes
<0> ok ty
<1> Of course, don't run that code *exactly*. It'll die.
<1> Initialize pt to something useful first.
<0> ok lemmie try
<0> thank you mr. mente
<0> so first I have a pointer to an object, then I set a reference to that pointer, and I can work with that reference all I want?
<1> Yes.
<0> WOOT
<0> thanks
<1> Thank Bjarne, not me.
<1> Any reason for the +m?
<2> i wrote an overload function inside the struct but im still getting an error saying now << operator for its type



<3> how did you do it?
<2> ill post it on pastebin, one sec,im sure i did it wrong :P
<1> std::ostream& operator<<(std::ostream& o, T const& t) { o << t.foo << t.bar; } // Should look like this
<3> if you're trying to write an output operator (<< with an ostream as lhs) then you can't make it a member
<1> mabaa, did you read the link I pasted earlier?
<1> http://www.parashift.com/c++-faq-lite/input-output.html
<1> If not, read it.
<1> Then read it again.
<1> Then read the whole FAQ.
<1> Then read that page again.
<2> http://pastebin.com/552147
<1> Perhaps it'll start to sink in.
<1> Yeah, that's exactly how it's not done.
<2> hehe
<2> yeh i didnt include a type in it
<1> No, that's not the problem.
<2> oh
<1> The problem is that it needs to be a free-standing function.
<1> Read the last several lines from YUY0x7 and I.
<1> Then read the FAQ page I pasted.
<2> im reading the faq again
<2> thanks for helping me
<1> Edited: http://pastebin.com/552150
<1> There's a separate FAQ section on serialization that's referenced from that section.
<1> Read that one, too.
<2> i am reading, but its saying Errorerror C2804: binary 'operator <<' has too many parametersc:\documents and settings\ben\my documents\visual studio 2005\projects\cs104***ignone\cs104***ignone\geneData.h
<2> oops on the paste
<2> thought it was going to be short
<2> i had made the same changes you made
<1> _exon foo; foo.start = 123; foo.end = 456; std::cout << foo; // Should print "123 456"
<1> With the edit that I made.
<2> Why would I be getting "binary operator << has too many parameters"
<1> I've no idea.
<2> hmm
<1> Either you made a typo or your code doesn't look like mine.
<2> well i used namespace std but besides that
<2> double checked
<0> lol, ty Bjarne
<2> this is the entire header file: http://pastebin.com/552168
<1> operator<< is not supposed to be a member of a cl***.
<1> You have it as a member of geneData.
<1> Make it a free-standing function.
<1> (As has been noted a couple of times).
<2> sorry
<1> Also, you should never put a "using namespace ..." in a header file.
<2> misunderstood
<2> oh no?
<2> why is that
<1> That pollutes the global namespace and can lead to name clashes.
<1> You may put them at the top of a function if you need to.
<1> But not outside in the header.
<1> Only at the top of a .cpp module, and even then you should be judicious.
<2> ah
<2> I moved it outside of the cl*** but now it doesnt know what _exon is, because it's private?
<1> It should be a friend cl***. That's also addressed in that FAQ page I pasted, which you *really* should stop and read.
<1> I mean, friend function.
<1> But please, read the FAQ.
<2> i did read that, i shouldnt have asked since i knew it
<2> was just thinking "out loud"
<2> its still not seeing it
<2> followed the faq, put the friend in public



<2> prototype matches
<2> http://pastebin.com/552177
<1> Ugh... now I see.
<1> First of all, does _exon *really* need to be a member of that cl***?
<2> Not really
<1> Second, if so, change the operator<< to std::ostream& operator<<(std::ostream& out, geneData::_exon const& e)
<1> If it doesn't, just put it above geneData.
<2> yeh that makes more sense
<0> since my program is really not important, can I make certain data members public, instead of providing every possible member function for accessing those data members?
<0> I made all the possible functions for accessing the data members and now I have to make more functions that will allow me to write over them!
<0> lol
<1> Pfloyd: Go for it.
<0> k, ty for your support
<2> I have a more fundamental question...I'm loading data from a text file now, so I want to create a temp datatype, set its values, then add it to the list, then continue through the loop and keep doing it until the file ends. should I be using a temp pointer and keep creating new datatypes or just using the same object and changing its value and then adding it
<4> Solamente are you there?
<4> I need help understanding this
<4> http://www.refactoring.com/catalog/replaceConditionalWithPolymorphism.html
<4> :~(
<2> Well all appears to be working but i have some wierd error while building in a .obj file
<5> help: I'm trying to read in (and run a code) on a large number of files within a folder, however the files does not have any specific naming order.
<5> Does anyone kno how? I remember I saw someone doing it once, it involved the '*.extension' somewhere
<5> but im not sure what it is anymore
<5> even better is if anyone kno how to do this in matlab
<6> seiye : do you want to get a list of all the files in a certain directory ?
<2> Im getting an "already defined in .obj" error but all of my header files are encoded in #ifndef #define ... #endif
<2> any ideas what else would cause that
<3> many things can cause that error
<6> mabaa : check the names of the .obj files that both define the symbol, and check the appropriate sources
<6> check every single header they both include - directly or indirectly
<6> or, you could actually copy-paste the same definition between the sources
<7> That sounds like overkill
<3> a non-inline non-template function definition in a header could cause it
<7> If it tells you what .obj file it's in, check that file's compilable unit, and the current compilable unit
<6> or you could search all of your files to find where is this symbol defined
<2> hmm
<2> they do all match up
<2> but maybe it is related to the template
<7> Check specifically what it's complaining about
<2> YU, i think you may have hit it on the nose...I have my struct and its << overload function in a headerfile outside of the cl***
<2> and thats in the file its complaining about
<3> yeah, that's likely the problem... put inline before the return type
<2> you are my hero :)
<3> ok ;)
<2> One more question -- more of a fundamental thing then debugging. I'm loading datafrom a textfile, and i want to put it in a temp object and then add it to a list
<2> so ill be looping through until the file comes to an end...how should I be doing that so the memory works out? Im having a little trouble twisting my mind around it
<3> what are you reading from the file?
<2> well theres 2 different files, a DNA and a gene file, I have a datatype for each thats designed to store the data. for DNA its just a int ID and a string
<2> for gene it has 2 ID#s an then a list of exons (what the struct is, just 2 ints, start pos and length)
<3> the DNA file contains varios DNAs each in a line? and you have a list where you want to insert the DNAs?
<3> various*
<2> yeh
<2> its parsing the data fine
<2> im just not sure how to add it to the list without wasting memory
<3> you probably should have operator>>(istream&, DNA&)
<7> Depends on what you want to do
<2> well heres how the structure is setup, but i know it isnt correct because im just using the same variable over and over again: http://pastebin.com/552247
<3> my_dnas.push_back(DNA()); if (file >> my_dnas.back()) { success }
<7> If the format's likely to vary, you might want a reader cl***, to separate it from your DNA cl***... if you're just trying to get from A to B, just define a stream for it, ***uming there's one datum per line (or per whatever makes sense parsing)
<2> no the input will be consistent id# sequence_String and then a -1 on the last line so the loop knows when to quit
<7> I'd just define a stream for it then
<7> streaming op
<3> mabaa, no need for a -1
<7> mabaa: Are you coming up with the format?
<2> Nope
<2> Its for a college course and the input file was given to us
<7> Is there more data after the line with -1 on it?
<2> no thats the terminal marker
<3> tell your professor that streams know when they've reach the end
<2> lol, she also forgot to close her streams in her sample code, and had another inconsitency in the input file and her directions/code
<5> <6> seiye : do you want to get a list of all the files in a certain directory ?
<5> exception: yes that would be helpful i think......
<5> then i can read the text file and input into the command
<3> seiye, boost.filesystem provides functions for that
<3> there's no standard c++ way of doing it


Name:

Comments:

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






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

#linux
#AllNiteCafe
#MissKitten
#MissKitten
#teens
patata il-forn
win32mapi
kde kgrellm
#linux
#php



Home  |  disclaimer  |  contact  |  submit quotes