| |
| |
| |
|
Page: 1 2 3 4 5 6 7 8 9 10 11 12
Comments:
<0> Such an ugly read <1> I don't know what he exactly wants to do <2> send binary data in an http request <1> how big is the data <2> a jpg <2> anywhere from 10k-300k <0> vector<char>++ <1> use an std::vector <1> er, what Ashe` said <2> it has to be binary safe though <0> Binary safe doesn't mean anything <2> it cant terminate on \0's <0> Why would it terminate on \0's <1> ? <1> neither an std::string nor an std::vector would "terminate on \0's" <1> they will store what you tell them to store
<3> JBlitzen: with std::copy and istream iterators, you can <4> Tell holospoof <2> i will paypal someone $10 to write this code for me <2> lol <3> prices = Answers are a dollar. Answers which require thought are five dollars. Correct answers are twenty dollars. Dumb looks and newbie torment come free, of course. Homework done for $1500-$2000/day or any part of that day (What's an 'A' worth to you?). Think Paypal! <2> im waaaay too tired <1> holospoof wtf, we're telling you <1> do you know about std::copy? <1> and std::istreambuf_iterator? <3> he doesn't need that, anyway <4> Would someone just tell him what he does need already <2> ill figure it out <2> thanks for helpin <3> JBlitzen: already did, on efnet <4> Cool <4> Thanks, kniht <5> man, the STL are like copy maniacs or something. A single call to map's insert() generate 2 calls to copy ctor instead of 1 as one would expect <4> Heh <5> i p*** a pair to insert that I created and that has already cost me a copy call, and what it does with it? it creates another copy of that pair <3> what do you expect? it has to copy it into the map, that's 1 copy, the other copy you did yourself <5> no <5> it does two copy calls on the insert alone <5> setProperty(const CProperty& prop){pair<string, CProperty> thisKeyProp(prop.getKey(), prop);m_propLookupTable.insert(thisKeyProp);} generate three calls to the copy ctor of prop <5> pair<string, CProperty> thisKeyProp(prop.getKey(), prop) <--- 1 call to prop's copy ctor <5> m_propLookupTable.insert(thisKeyProp); <---- 2 calls <5> for some reason, it recreate a pair from the pair I gave it <3> then your implementation ****s <5> my implementation is only two lines of code <3> your std::map implementation is very likely more than two lines of code <3> map::insert requires at least one copy (to insert into the map), but no more <5> ok, you meant 'my' as in my compiler's? <3> yes <5> ok <3> although they aren't inseparable <5> yeah, it should only generate one copy on insert() <5> but for some reason, the copy is done here first: <5> template<cl*** _Other1,cl*** _Other2> <5> pair(const pair<_Other1, _Other2>& _Right) <5> : first(_Right.first), second(_Right.second) <5> {// construct from compatible pair} <3> however, this presumes pair<string, CProperty> is your value_type, and it's not <5> second(_Right.second) is where the call to copy ctor happens <3> so that's where the other copy is from, constructing a temporary to bind the map::value_type const& to <3> map provides a typedef for a reason, use it <5> sorry Kniht, I am not very efficient yet with STL. how can I use that typedef? <3> I wouldn't bother for types that are cheaply default constructable <3> m[key] = value <3> Map::value_type is the typedef, where Map is the type of your map <3> and I take that back, your implementation is fine, it's your use that ****s :P <5> You bastard! <5> I was happy there for a while that I did somthing that sisnt **** <3> why did you avoid the obvious m[key] = value? <5> because I benchmarked it <5> turns out it is 4-5x slower then insert() <3> your benchmark led you astray in this case <3> and it would only be valid your implementation, in any case <3> did you profile? is that your bottleneck? <5> well, I will still use the insert() method knowing that it is 4x ~ 5x faster <6> likoo: how to benchmark a c++ function? <5> yes, on my implementation <3> doesn't matter if it's 100 times faster, if that's not your bottleneck
<5> javaq:precisiom timers <6> what software? <0> He counted on his fingers <5> Kniht:it could become a bottlneck though <6> arrays is faster than vector <0> Of course I wouldn't use it on the STL <6> no s <5> DevPartner is pretty good <5> numega used to make high grade software, until they got baught by compuware <5> I am still trying to figure out how to use that ::value_type <0> map<K,T>::value_type <5> yes, then what? <0> insert( map<K,T>::value_type( key, value ) ); <5> oh, instead of pair? <5> neat <6> push_back instead of insert <5> on a map? i though that wouldnt be good <5> if the key exists it will override it <5> but not at the back <5> yay!! ::value_type saved me from that dreaded copy ctor call! <3> likoo: anything could become a bottleneck, worry about known bottlenecks first <3> and if you don't know any, find some <5> ok, I think I worry too much about bottleneck all the time. Coming from C/Asm background, I don't even want to look at the code that the STL produces <0> Even in C, you don't look for bottlenecks ever 5 seconds, just get it to work first <0> +y <5> I do :-/ <0> Yes, but that's cause you're bad ;) <5> ever function I write has to be the most optimal it could be. and the I re-ietarate after the initial stage <5> Ashe: lol, no, I am paranoid <0> So it takes you 500% of the time to write it, but you gain 1% in speed <0> Maybe it's the time you spend that you should make optimal, not the time your program spends ;) <5> you see, for example, this ::value_type issue, I would have never knew about it. and GOD knows how many STL 'faux pas' i am making that are costing me speed <3> and spending that much wasted time means he either misses more important improvements or he misses the schedule <3> you don't have an STL reference? <3> ref = Some C++ Reference Sources: (1) Your compiler documentation (2) http://www.dinkumware.com/manuals/reader.aspx?lib=cpp (3) http://msdn.microsoft.com/library/en-us/vcstdlib/html/vcoriStandardCLibraryReference.asp?frame=true (4) http://www.sgi.com/tech/stl/ (5) http://www.cppreference.com (*) http://www.google.com <0> It takes you so long to write it that computers are 3x faster by the time you (if you ever do) complete the job <5> Ashe:LOL <3> you didn't know the parameter types for insert? <5> well at work I code in JAVA, and I don't give anywhere near as much attention to speed then when I code at home <5> Java is inheritly slow, and there isn't much I can do about it <5> Kniht: I thought it took a pair, that is why I created one before hand <3> what made you think it took a pair? <3> guess = Programming by guessing does not work, so you better -->RTFM. <5> I think some example I see on the net <0> + by not using value_type your code breaks if you change the map <0> (change its type, that is) <7> a lot of examples actually use pair <7> sadly <3> 90% of anything is crud <6> map<K, V>? k can be an int? <0> Why not <0> As long as you can do < on it <6> k <3> or use whichever comparator the map uses :P <5> Kniht: crud? as in Create, Regroup, Update, Delete? <3> no, as in **** <1> haha <5> lol <5> HEY! <5> I did read the RTFM, in fact this is where I got the samples from <5> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcstdlib/html/vcoriStandardCLibraryReference.asp <0> ****? as in Serialize, Highlight, Iterate, Treat? <3> even though that's listed in the ref calc, I don't like it <5> m1.insert ( Int_Pair ( 4, 40 ) ); <3> dinkum is better, and I use the standard itself <5> ok <3> Ashe`: no, as in SHut-up Internet Troll :P <0> :'( <3> Silence Hubristic Internet Troll just didn't work as well <0> Sig Hup <5> hmm..I am looking in map.insert on dinkum but I would have never guess what it needs or especially that I could p*** it a ::value_type <5> pair<iterator, bool> insert(const value_type& val); <5> Oh
Return to
#c++ or Go to some related
logs:
#c++ #linux #c++ lebcafe glut.h in knoppix forum is it expired #chatzone zenn diagram #c++ lizbjani
|
|