@# 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



Comments:

<0> yes
<1> nice, with a 1?
<1> as the value
<0> no, where did it get 1?
<1> the ++
<0> ++ is increment
<0> the value gets default constructed
<1> increment what?
<0> increment whatever is stored at my_map[key]
<1> the key or the value that the key is ***ociated with
<1> and if my_map[key] doesn't exist and I increment it, what will happen then ?
<0> it will create a value and increment it
<0> if that's a map of ints, it might just initialize the value to 0, too
<0> but i'm not positive on that, consult josuttis
<1> ok
<1> I will do a find first



<1> if(my_map.find(2) != my_map.end()) ++my_map[key]; else my_map[key] = 1; ?
<0> bleh, no
<1> heh
<0> if you use find
<0> it willl return an iterator
<0> if that iterator isn't .end(), increment the value by using the iterator
<0> otherwise, call .insert()
<2> ya it will default construct
<2> so int() == 0
<0> MyMap::iterator iter = my_map.find(2); if( iter != my_map.end() ){ ++iter->second; } else { my_map.insert( make_pair(2,1) ); }
<1> rdragon, why would it increment the value by using the iterator?
<1> oh
<1> thanx
<2> wait no
<2> that's too complicated no
<0> 'it' doesn't, you do
<1> haha
<1> ok
<0> but
<2> what's wrong with ++mymap[number];
<0> if Cowmoo is correct, then ++my_map[2]; works just as well
<2> he's just building a histogram
<1> thats right
<0> I wasn't sure if default construct initialized to 0, that's why
<1> a histogram
<2> werd
<1> heh
<1> rdragon, I like your way, I am not calling find() twice that way
<1> or am I
<0> right
<1> well 3 times even
<1> I find() will get called on insert now wont it
<2> waaat?
<0> threat
<0> just use
<0> ++my_map[blah];
<1> ok
<1> my_map[blah]++; is the same right?
<0> yes, but not as good
<1> yes because it does a post-increment?
<0> well, yes
<1> that is fine since I dont need to use that value on that line
<1> I just need to increment and that is all
<1> rdragon, thanx :)
<1> ok, I have a map that is a histogram, I now want to find the key with the lowest value
<1> is a map a good choice? or do I need to use another type
<1> nm, yay for linear searching :P
<2> threat read the docs
<2> map is a binary search tree, so yes elements are ordered
<0> yes, maps are sorted, so...
<1> this is going to be so inefficient, oh well, my map will never grow more then 1000 elements
<2> inefficient why??
<1> Cowmoo, based on the key though, not the value
<2> yes
<1> Cowmoo, the way I am doing it now is going to be inefficient
<2> which is why vawjr told you to copy it all to an std::multimap, with the values from your std::map as the keys
<1> Cowmoo, I want to find the key that has the smallest value
<1> but if I copy it that will be n, if I am looking for the smallest value that will be an n search to
<1> if I copy then search it will be n + log(n)
<2> well, more like O(nlog(n) )
<2> yea, you're right



<2> (since to construct the tree it's O(n log n)
<2> well, realise that it doesn' tmatter for what you want to do
<2> premature optimisation is the root of all evil and all that
<2> although you could provide your std::map with your own comparator
<2> which orders based on values not keys
<1> Cowmoo, yes I could use some inheritents and all that funky stuff, but I CBF :P
<2> suit yourselrf
<1> Cowmoo, root indeed :)
<1> nm
<3> http://video.google.com/videoplay?docid=2730702006104329647&q=Andy+Kaufman+snl&pl=true
<1> I have a list<int>::iterator, I do a find() on the list for a value, I want to cout what position in the list the value is. Can I cout the iterator directly or do I need to use a different function?
<4> What is up.
<1> hey
<5> i want to buy some books and can`t decide for 2 of them i have found
<5> i don`t know which one is better for a novice
<5> can anyone help me ?
<3> Yeah, Code
<3> What are they?
<5> can i give you the 2 links ?
<3> In channel
<5> one of them is written by Bjarne Stroustrup it has 1104 pages
<3> The C++ Programming Language
<5> http://www.teora.ro/descrieri/0894.htm
<3> A wonderful book for people who already know the language
<3> It's not a book for beginners
<3> What's the other one
<5> it`s written by Jamsa Kris, Klander Lars
<5> Fundamental Basics in C and C++
<3> I'm totally unfamiliar with that
<3> Which means that it's probably not great
<3> But, judging from the names and from your location, it may be translated into Romanian
<3> +well
<3> So, I'd probably lean toward that one, given no other options.
<5> yes it is .. but i also dot mind a bot written in english
<5> dont*
<3> Oh
<3> Well, Accelerated C++ is well recommended for newbies who are fluent in English
<3> I like the C++ How to Program book by Deitel, but it really requires that you know English well
<3> ftp://ftp.prenhall.com/pub/esm/sample_chapters/engineering_computer_science/deitel/CppHTP5e/pdf/cpphtp5_02.pdf
<3> There's a sample chapter, see if it's up your alley or not, probably not.
<5> oh .. a pdf .. i always thought that a good book costs money .. and don`t want an electronic format book
<3> That's a sample chapter, not a pdf book
<3> They have a few sample chapters online so you can see what the book is like before buying
<3> Accelerated C++ probably has some up, too, somewhere, but I never looked.
<5> oh great but how much does it cost ? Accelerated C++ i think is what i want
<5> and can I buy that in my country ?
<3> I think Accelerated C++ is nearly half the price of the Deitel one
<3> I'm sorry, I have no idea what's available in Romania
<3> We tend to get a lot of chatters from there, though, so don't give up hope
<3> Someone here might have some more relevant advice for you.
<3> Although it's been quiet here for a few hours, so I wouldn't expect much soon.
<5> I sure hope so .. I`ve been trying to learn it with online manuals but that doesn`t work
<3> Well, sounds like you have your head on straight, one way or another
<3> Better an intelligent reader than a perfect book
<3> But look around the internet, I'm sure there are websites around that have good reviews of programming books for Romanians
<3> If not, create one and get rich off the ads, because a lot of people ask.
<3> http://www.amazon.com/gp/reader/020170353X/ref=sib_dp_pt/104-3499817-6296711#reader-page
<3> There are some sample pages from Accelerated C++
<5> I tried that by making a website but it`s too much work for me to do alone .. I only know few about webdesign
<3> nod
<3> Heh
<5> if Accelerated means learn c++ in a couple of days .. I really am not in a hurry .. I will take time as long as I have to in order to learn it well
<3> You have the right attitude, but Accelerated C++ is legitimately a well regarded book in its own right
<3> It's not like one of those learn C++ in 24 hours books
<3> Take a look at those sample pages and see if it's your speed
<5> I need a book that can explain how everything works not just give examples of code and explain what that does
<3> Well
<3> Stroustrup's book really is very good if you already know the language to some extent.
<5> I only know how to do a simple input output program using cout and cin .. and that`s it
<3> I haven't read Accelerated C++, so I can't speak for it, but I know that the guys in here whose opinions I would trust really like it.
<3> Yeah, Bjarne's book might fly right over your head.
<3> But, it might not.
<3> http://public.research.att.com/~bs/3rd.html


Name:

Comments:

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






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

#java
#chatzone
#chatzone
#php
#apache
#squid
#chatzone
Who was Tom Thumb's female counterpart
the nautical term for a distance of three miles
emerge fslint



Home  |  disclaimer  |  contact  |  submit quotes