template<typename KEY,typename VALUE>
struct MapConstructor : public QMap<KEY,VALUE>
{
MapConstructor<KEY,VALUE>& insert(const KEY &key, const VALUE &value)
{
QMap<KEY,VALUE>::insert(key, value);
return *this;
}
};
QMap<QString,int> aMap = MapConstructor<QString,int>().insert("hello",5).insert("world",5).insert("hell",4);
template<typename KEY,typename VALUE>
struct MapConstructor : public QMap<KEY,VALUE>
{
MapConstructor<KEY,VALUE>& insert(const KEY &key, const VALUE &value)
{
QMap<KEY,VALUE>::insert(key, value);
return *this;
}
};
QMap<QString,int> aMap = MapConstructor<QString,int>().insert("hello",5).insert("world",5).insert("hell",4);
To copy to clipboard, switch view to plain text mode
Bookmarks