add iterator

This commit is contained in:
laplaceyang 2016-12-08 21:39:24 +08:00
parent 55c2eea1a7
commit 5cd848273a

View File

@ -46,6 +46,13 @@ private:
std::deque<message_t> m_parts; std::deque<message_t> m_parts;
public: public:
typedef std::deque<message_t>::iterator iterator;
typedef std::deque<message_t>::const_iterator const_iterator;
typedef std::deque<message_t>::reverse_iterator reverse_iterator;
typedef std::deque<message_t>::const_reverse_iterator const_reverse_iterator;
// Default constructor // Default constructor
multipart_t() multipart_t()
{} {}
@ -113,6 +120,56 @@ public:
return m_parts.at(n); return m_parts.at(n);
} }
iterator begin()
{
return m_parts.begin();
}
const_iterator begin() const
{
return m_parts.begin();
}
const_iterator cbegin() const
{
return m_parts.cbegin();
}
reverse_iterator rbegin()
{
return m_parts.rbegin();
}
const_reverse_iterator rbegin() const
{
return m_parts.rbegin();
}
iterator end()
{
return m_parts.end();
}
const_iterator end() const
{
return m_parts.end();
}
const_iterator cend() const
{
return m_parts.cend();
}
reverse_iterator rend()
{
return m_parts.rend();
}
const_reverse_iterator rend() const
{
return m_parts.rend();
}
// Delete all parts // Delete all parts
void clear() void clear()
{ {