daily pastebin goal
44%
SHARE
TWEET

Untitled

a guest Jul 18th, 2018 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. std::unordered_map<int, std::unordered_map<int, std::unique_ptr<deviceTypeX>>> deviceTypeXMap;
  2.    
  3. template <typename classType>
  4. void addInstance(std::unordered_map<int, std::unordered_map<int, std::unique_ptr<classType>>> &outer,
  5.                              int outerKey, std::unique_ptr<classType> instanceToAdd, int innerKey) {
  6.     auto outerSearch = outer.find(outerKey);
  7.     if (outerSearch != outer.end()) {
  8.         outerSearch->second.try_emplace(innerKey, std::move(instanceToAdd));
  9.     }
  10.     else{ //outer key not found }
  11. }
  12.    
  13. addInstance(deviceTypeXMap, desc.idVendor, std::make_unique<specificDevice>(dev, ctx), desc.idProduct);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top