15 lines
329 B
C
15 lines
329 B
C
|
#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];
|
||
|
}
|
||
|
};
|