我在使用以下代码时遇到问题:
#include <list>
#include <boost/shared_ptr.hpp>
#include "Protocol/IMessage.hpp"
template <typename HeaderType>
class Connection {
public:
typedef IMessage<HeaderType> MessageType;
typedef boost::shared_ptr<MessageType> MessagePointer;
template <typename Handler>
void
FlushMessageQueue(Handler handler) {
std::list<MessagePointer>::iterator ib = message_queue_.begin(); // line 69
std::list<MessagePointer>::iterator ie = message_queue_.end();
for (; ib != ie; ++ib) {
AsyncWrite(*ib, handler);
}
}
private:
std::list<MessagePointer> message_queue_;
};
gcc (4.2.1) 告诉我:
include/Network/Connection.hpp: In member function 'void Network::Connection<MT>::FlushMessageQueue(Handler)':
include/Network/Connection.hpp:69: error: expected `;' before 'ib'
我想知道为什么我不能为 MessagePointer 的列表创建迭代器。
有任何想法吗?
谢谢你。