You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
CloningExample/Example/safemap.h

15 lines
329 B

#pragma once
#include "olcPixelGameEngine.h"
template<typename T,typename O>
class safemap{
static bool initializeCompleted;
std::map<T,O>map;
public:
O&operator[](T key){
if(initializeCompleted&&map.count(key)==0){
std::cout<<"WARNING! Trying to get non-existent key "<<key<<"!"<<std::endl;
}
return map[key];
}
};