Я не могу понять, почему я получаю эту ошибку:
/usr/local/include/boost/asio/impl/read.hpp: In member function ‘void boost::asio::detail::read_op<AsyncReadStream, boost::asio::mutable_buffers_1, CompletionCondition, ReadHandler>::operator()(const boost::system::error_code&, size_t, int) [with AsyncReadStream = boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >, CompletionCondition = boost::asio::detail::transfer_at_least_t, ReadHandler = boost::function<void ()(long unsigned int)>]’:
/usr/local/include/boost/asio/impl/read.hpp:263: instantiated from ‘void boost::asio::async_read(AsyncReadStream&, const MutableBufferSequence&, CompletionCondition, ReadHandler) [with AsyncReadStream = boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >, MutableBufferSequence = boost::asio::mutable_buffers_1, CompletionCondition = boost::asio::detail::transfer_at_least_t, ReadHandler = boost::function<void ()(long unsigned int)>]’
src/communicator/protocol/Command.cc:34: instantiated from here
/usr/local/include/boost/asio/impl/read.hpp:215: error: no match for call to ‘(boost::function<void ()(long unsigned int)>) (const boost::system::error_code&, const long unsigned int&)’
/usr/local/include/boost/function/function_template.hpp:1007: note: candidates are: typename boost::function1<R, T1>::result_type boost::function1<R, T1>::operator()(T0) const [with R = void, T0 = long unsigned int]
make: *** [src/communicator/protocol/Command.o] Error 1
Здесь мой класс: Command.hh
namespace communicator {
namespace protocol {
namespace in {
class Command : public boost::enable_shared_from_this<Command> {
public:
~Command();
typedef boost::shared_ptr<Command> pointer;
void got_newline();
protected:
Command(tcp::socket& socket, structure::Client& client) :
m_socket(socket), m_client(client) {};
void endParsing();
tcp::socket& m_socket;
structure::Client& m_client;
char m_newline[2];
private:
};
}
}
Command.cc:
namespace communicator {
namespace protocol {
namespace in {
void Command::endParsing() {
boost::function<void()> cb = boost::bind(&Command::got_newline,
shared_from_this());
boost::asio::async_read(m_socket,
boost::asio::buffer(m_newline, 2),
boost::asio::transfer_at_least(2),
**ERROR POINTING THIS LINE** cb);
}
void Command::got_newline() {
if (m_newline[0] == '\r' && m_newline[1] == '\n') {
std::cout << "End" << std::endl;
}
}
}
}
}
Проверьте "** Ошибка наведения этой строки **" на блок кода, вот где у него есть проблема ... не знаю почему, снова и снова ломал мне голову ...
Спасибо за помощь
Я удалил код для ясности, если у вас есть какие-либо вопросы, не стесняйтесь