M
mosfet
Hi,
I would like to write a class storing http headers so Istarted with this :
class WebHeaderCollection
{
private:
std::map<tstring, tstring> m_KeyValueMap;
public:
tstring& operator[](const tstring& Keyval)
{
tstring sTmp = Keyval + _T("\r\n");
return m_KeyValueMap[ Keyval ];
}
};
This class appends \r\n to each key entry.
My question is how can I give access to all the standard operations of a
map.
The simple solution would have been to derive from std::map but it seems
to be a bad idea to derive from STL containers.
So does it mean I need to provide an iterator, an overload operator like
I did, ...
Do you have some example?
I would like to write a class storing http headers so Istarted with this :
class WebHeaderCollection
{
private:
std::map<tstring, tstring> m_KeyValueMap;
public:
tstring& operator[](const tstring& Keyval)
{
tstring sTmp = Keyval + _T("\r\n");
return m_KeyValueMap[ Keyval ];
}
};
This class appends \r\n to each key entry.
My question is how can I give access to all the standard operations of a
map.
The simple solution would have been to derive from std::map but it seems
to be a bad idea to derive from STL containers.
So does it mean I need to provide an iterator, an overload operator like
I did, ...
Do you have some example?