Guest User

Untitled

a guest
Jul 18th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  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);
Add Comment
Please, Sign In to add comment