A Guy and gal in STL
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share

A Guy and gal in STL

  • 329 views
Uploaded on

An approach to understand Multi-Map of STL in C++ without using bigger technical terms or with a prospective of little bit entertaining instances of life going around.

An approach to understand Multi-Map of STL in C++ without using bigger technical terms or with a prospective of little bit entertaining instances of life going around.

More in: Education
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
329
On Slideshare
329
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
2
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. STL (Multimap) – C++Guy and Gal in STL Hi, all its really a long time that I was away from this all. Few days back while I was just working, I got a chance to implement Map/Multi-Map of C++(STL). And trust me I found a cute sketch with all innocence of the bond of love within a "Couple" or more suitable word that can I choose, will be "Pair" (means both of them are just completingeach other), off course in Multi-Map/Map of STL.Here, I can bet you will realize my words are not just words butits just the voice of your heart.For the shake of trust you can execute the code snippet.You can find the technical definition of the terms all over theinternet and Off-course I will not waste my time for that. I thinklets change our angle of position and have a look, you will find theimprints of complete love. I dont know you had ever loved anyoneor not but yes, if you have any practical experience then you canvisualize the portraits more clearlyOkee, so lets have a short story about a pretty gal and a guy(ohh , you can imagine this as your friend ).Let’s change a Bit Page 1
  • 2. STL (Multimap) – C++In my case, the gal is so pretty that the guy never ever wishes tosee her nervous, sad or tense face. As;std::string pretty_gal = "dazzling_smile";std::string a_gentle_guy = "guy_in_love";His just a wish to make her all happy and No-one knows how hemanages all this against every odds. I dont know about the realscenario but lets create a bond within them, As;std::pair loving_couple;loving_couple = std::make_pair(pretty_gal,a_gentle_guy);Even I am lacking, the exact sentiments of the guy, but all that heneed, is her happiness may be as; he wants his identification withthat only. I or Any guy, just can imagine that how deeply he isattached with her and I really dont have any experience of beingGal So I think a Gal reader can visualize it some what similar.(***Note*** (for Gal): ... Can Visualize It, If they have some goodcoordination between heart and brain, All they lack at this point, Iknow It. Whatever Exceptions are always there)So our gentle guy has mapped himself within the happiness of thegal as;std::multimap feeling_bond;feeling_bond.insert (loving_couple);Now if, you need to find the guy, you can make use of just a singlereference as gals smile;std::multimap::iterator _bond_;_bond_ = feeling_bond.find("dazzling_smile");Let’s change a Bit Page 2
  • 3. STL (Multimap) – C++printf("%s for %s", _bond_->second.c_str(),_bond_->first.c_str());And the Output window will show you a message:Output Window: "guy_in_love for dazzling_smile"Yes It may possible, that you have some or all differentprospective with the concept and even with example orscenario, that I had selected. I really dont need it. Andplease dont try to certify this; I will hardly bother aboutit.As Always I thought to express my view in favor of concept I donethat, you dont like it, Its completely your choice and I will alwayshave respect for that. Programming is just Fun If you are capableto enjoy it ... So ... Take Care ... in someones style not mine, I usedto say ... Catch you again ...The Overall code can be found as bellow and is runningsuccessfully in Win32 Console Application with VC9 inVisual Studio 2008.//-------------------//Code Snippet//-------------------#include "stdafx.h"#include "iostream"#include "string"#include "map"Let’s change a Bit Page 3
  • 4. STL (Multimap) – C++void test_func(void){ std::string pretty_gal = "dazzling_smile"; std::string a_gentle_guy = "guy_in_love"; std::pair loving_couple; loving_couple = std::make_pair(pretty_gal,a_gentle_guy); std::multimapfeeling_bond; feeling_bond.insert(loving_couple); std::multimap::iterator bond_itr; bond_itr =feeling_bond.find("dazzling_smile"); printf("%s for %s", bond_itr->second.c_str(), bond_itr->first.c_str());}int main(){ test_func(); printf("nnn"); return 0;}Let’s change a Bit Page 4