Gui restable: add/remove columns
This commit is contained in:
@@ -186,4 +186,31 @@ struct TempBuf {
|
||||
#define deleteZ(X) {delete X;X = 0;}
|
||||
#endif
|
||||
|
||||
// Code for static initialization of an stl map. Somewhat like Boost.assign.
|
||||
// Ref: http://stackoverflow.com/questions/138600/initializing-a-static-stdmapint-int-in-c
|
||||
// Example use: map<int, int> m = map_list_of (1,2) (3,4) (5,6) (7,8);
|
||||
|
||||
template <typename T, typename U>
|
||||
class create_map
|
||||
{
|
||||
private:
|
||||
std::map<T, U> m_map;
|
||||
public:
|
||||
create_map(const T& key, const U& val)
|
||||
{
|
||||
m_map[key] = val;
|
||||
}
|
||||
|
||||
create_map<T, U>& operator()(const T& key, const U& val)
|
||||
{
|
||||
m_map[key] = val;
|
||||
return *this;
|
||||
}
|
||||
|
||||
operator std::map<T, U>()
|
||||
{
|
||||
return m_map;
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* _SMALLUT_H_INCLUDED_ */
|
||||
|
||||
Reference in New Issue
Block a user