Advertisement
Vultraz

Untitled

Sep 7th, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. preferences::acquaintance* add_friend(const std::string& nick, const std::string& notes) {
  2.     if(!utils::isvalid_wildcard(nick)) {
  3.         return nullptr;
  4.     }
  5.  
  6.     preferences::acquaintance new_entry(nick, "friend", note);
  7.  
  8.     acquaintances_map::iterator iter;
  9.     bool success;
  10.  
  11.     std::tie(iter, success) = map.emplace(nick, new_entry)
  12.    
  13.     if(success) {
  14.         save_acquaintances();
  15.  
  16.         return &iter->second;
  17.     }
  18.    
  19.     return nullptr;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement