InputMap.hpp 452 B

123456789101112131415161718192021222324252627
  1. #pragma once
  2. #include <unordered_map>
  3. #include "Input.hpp"
  4. template<typename T = int>
  5. class InputMap
  6. {
  7. public:
  8. InputMap(const InputMap& copy) = delete;
  9. InputMap<T>& operator=(const InputMap<T>& copy) = delete;
  10. InputMap() = default;
  11. void map(const T& key, const Input& input)
  12. {
  13. _map.emplace(key, input);
  14. }
  15. const Input& get(const T& key) const
  16. {
  17. return _map.at(key);
  18. }
  19. private:
  20. std::unordered_map<T, Input> _map;
  21. };