jeudi 23 juillet 2015

Problems with map container

Introduction

I'm trying to create a port-forwarding sample with tcp connections, so I need map client identification with his socket. When the client requests port-forwarding, I have to know who owns the sockets.

To do that, I created the following code:

std::map<std::string, tcp::socket> box_map;

std::map<std::string, tcp::socket>::iterator it;
it = box_map.find(id);
if (it != box_map.end())
    return;
else{
    box_map.insert(std::pair<std::string, tcp::socket>(id,s));
    return;
}

Problem

But I got the following error:

error: use of deleted function ‘boost::asio::basic_stream_socket<boost::asio::ip::tcp>::basic_stream_socket(const boost::asio::basic_stream_socket<boost::asio::ip::tcp>&)’

Aucun commentaire:

Enregistrer un commentaire