Created
November 4, 2013 16:46
-
-
Save RklAlx/7305482 to your computer and use it in GitHub Desktop.
std::map
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <map> | |
#include <string> | |
using std::map; | |
using std::string; | |
class CTeste | |
{ | |
public: | |
CTeste(){} | |
~CTeste(){} | |
}; | |
int main() | |
{ | |
map<string,CTeste> my_map; | |
// If "Teste" exists, my_teste will point to that object. | |
// If "Teste" does not exist, map wil call the default constructor of CTeste and return the newly created object | |
CTeste& my_teste = my_map["Teste"]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment