fork download
  1. #include <iostream>
  2. #include <map>
  3.  
  4. using namespace std;
  5.  
  6. template <typename T>
  7. class MultiMapa {
  8. public:
  9. typedef T ValueType;
  10. //lub: typedef std::shared_ptr<T> ValueType;
  11. private:
  12. std::map<int, ValueType> m_map1;
  13. std::map<string, ValueType> m_map2;
  14. //...
  15. public:
  16. MultiMapa() {
  17.  
  18. }
  19.  
  20. void erase(ValueType value)
  21. {
  22. erase(m_map1, value);
  23. erase(m_map2, value);
  24. }
  25.  
  26. template<class Map, typename ValueType>
  27. void erase(Map &map, ValueType value)
  28. {
  29. // implentacja dla konkretnej mapy
  30. }
  31.  
  32. };
  33.  
  34. int main() {
  35.  
  36. MultiMapa<double> mapa;
  37. //...wypelnienie
  38. mapa.erase(2.0);
  39. return 0;
  40. }
Success #stdin #stdout 0s 2848KB
stdin
Standard input is empty
stdout
Standard output is empty