/** * A Hashmap class for easier Key-Value maps * * @author Lukas Heiligenbrunner * @date 07.04.2019 */ #pragma once #include #include template class Hashmap { public: /** * add key-value pair to hashmap * @param key keyvalue * @param value valuevalue */ void add(keytype key, keytype value); /** * get key of specific position * @param position int position * @return responding key object */ keytype getKey(int position); /** * get value of specific position * @param position int position * @return responding value object */ valuetype getValue(int position); /** * get size of Hashmap * @return size of Hashmap */ int size(); private: std::vector keys; std::vector values; }; template void Hashmap::add(keytype key, keytype value) { keys.push_back(key); values.push_back(value); } template keytype Hashmap::getKey(int position) { return keys.at(position); } template valuetype Hashmap::getValue(int position) { return values.at(position); } template int Hashmap::size() { return (int) (keys.size()); }