Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <map>
- std::map<std::string, int> relation_map;
- void setRelationState(std::string guid, int rel){
- for (std::map<std::string, int>::iterator pos = relation_map.begin(); pos != relation_map.end(); pos++)
- {
- if (pos->first.compare(guid) == 0){
- pos->second = rel;
- return;
- }
- }
- relation_map.insert(pair<std::string, int>(guid, rel));
- }
- int getRelationState(std::string guid){
- for (std::map<std::string, int>::iterator pos = relation_map.begin(); pos != relation_map.end(); pos++)
- {
- if (pos->first.compare(guid) == 0){
- return pos->second;
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment