Pregunta

I have this code:

class Connection
{
public:
    boost::asio::ip::tcp::socket socket_;
}

void main()
{
   Connection* session = new Connection();
   //for example
   session->socket_.close() // FATAL ERROR PAGE FAULT
   // How to check whether child member socket_ is null? if(session->socket_ != NULL) - error : no operator != mathes these operands
}

When i try if(session->socket_ != NULL) - error : no operator != mathes these operands

I Use VS2010

Thanks!

¿Fue útil?

Solución

socket_ is not a pointer and so no operator is define to compare it against NULL. Maybe you need to use is_open.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top