2013-06-29 19:15:55 -07:00
|
|
|
#pragma once
|
|
|
|
|
|
2022-01-30 15:49:02 -08:00
|
|
|
#include <map>
|
|
|
|
|
|
2013-06-29 19:15:55 -07:00
|
|
|
template <typename T, typename U>
|
|
|
|
|
class InitConstMap
|
|
|
|
|
{
|
|
|
|
|
private:
|
2021-04-30 22:59:41 -07:00
|
|
|
std::map<T, U> m_map;
|
2013-06-29 19:15:55 -07:00
|
|
|
public:
|
2021-04-30 22:59:41 -07:00
|
|
|
InitConstMap(const T& key, const U& val)
|
|
|
|
|
{
|
|
|
|
|
m_map[key] = val;
|
|
|
|
|
}
|
2013-06-29 19:15:55 -07:00
|
|
|
|
2021-04-30 22:59:41 -07:00
|
|
|
InitConstMap<T, U>& operator()(const T& key, const U& val)
|
|
|
|
|
{
|
|
|
|
|
m_map[key] = val;
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
2013-06-29 19:15:55 -07:00
|
|
|
|
2021-04-30 22:59:41 -07:00
|
|
|
operator std::map<T, U>()
|
|
|
|
|
{
|
|
|
|
|
return m_map;
|
|
|
|
|
}
|
2013-06-29 19:15:55 -07:00
|
|
|
};
|