5

在使用C++11Boost.Asio的应用程序中,我开始使用 lambda 函数和std::unique_ptr. 我想将此 unique_ptr 的所有权转移给 lambda。您无法按值捕获 unique_ptr,因为此类不提供复制构造函数。通过引用来捕获它也很愚蠢,因为我确实想要所有权转移。

我决定使用它作为这个 lambda 函数的最后一个参数std::bind来传递。unique_ptrstd::move用来给这个 lambda 一个 r 值引用。稍后我会将这个 r 值移动到std::unique_ptr(本地到 lambda)中。我遇到了一些可怕的 gcc 错误,想知道我在代码中遗漏了什么。

这是包含我丑陋的非工作技巧的代码:

void NetworkClient::start()
{
    // Avoid the naggle algorithm on packets.
    ip::tcp::no_delay optionNoDelay(true);
    socket_.set_option(optionNoDelay);

    // Lambda function that receive a packet header.
    std::function<void (const boost::system::error_code& error, std::size_t bytesTransfered)> receiveHeaderHandler =
    [this, &receiveHeaderHandler] (const boost::system::error_code& error, std::size_t bytesTransfered)
    {
        if (error)
        {
            std::cout << LogType::ERROR << "Error while receiving a packet header" << std::endl;
        }

        if (bytesTransfered < 6)
        {
            std::cout << LogType::ERROR << "Invalid packet received: header size < 6" << std::endl;
        }

        std::cout << "Packet received" << std::endl;

        // Allocate memory for the incoming packet body.
        std::unique_ptr<char[]> packetBody(new char[currentHeader_.size()]);

        // Let's receive the packet body according to the header.
        socket_.async_receive(buffer(packetBody.get(), currentHeader_.size()), std::bind
        ([this, &receiveHeaderHandler] (boost::system::error_code const & error, std::size_t bytesTransfered, std::unique_ptr<char[]> && arg)
        {            
            if (error)
            {
                std::cout << LogType::ERROR << "Error while receiving a packet header" << std::endl;
            }

            if (bytesTransfered < currentHeader_.size())
            {
                std::cout << LogType::ERROR << "Invalid packet received: size of packet < size from header" << std::endl;
            }

            std::unique_ptr<char[]> packetBody(arg);     

            socket_.async_receive(buffer(currentHeader_.data(), 6), receiveHeaderHandler);
         }, std::placeholders::_1, std::placeholders::_2, std::move(packetBody)));
    };

    socket_.async_receive(buffer(currentHeader_.data(), 6), receiveHeaderHandler);
}

这是修剪和清洁的越野车部分:

        // Allocate memory for the incoming packet body.
        std::unique_ptr<char[]> packetBody(new char[20]);

        // Let's receive the packet body according to the header.
        socket_.async_receive(asio::buffer(packetBody.get(), 20), std::bind(
        [] (boost::system::error_code const & error, std::size_t bytesTransfered, std::unique_ptr<char[]> && arg)
        {
            std::unique_ptr<char[]> packetBody(arg);

        }, std::placeholders::_1, std::placeholders::_2, std::move(packetBody)));

在这段代码中:

  • packetBody 是我要传输的 std::unique_ptr
  • async_receive 处理程序必须看起来像void handler(const boost::system::error_code& error,std::size_t bytes_transferred);
  • 设计看起来很丑,但我想深入尝试 c++11 lambdas

这是我的 gcc 输出:

In file included from /usr/include/boost/asio.hpp:30:0,
                 from server/network/./network-client.hpp:4,
                 from server/network/network-client.cpp:1:
/usr/include/boost/asio/basic_stream_socket.hpp: In instantiation of 'void boost::asio::basic_stream_socket<Protocol, StreamSocketService>::async_receive(const MutableBufferSequence&, ReadHandler&&) [with MutableBufferSequence = boost::asio::mutable_buffers_1; ReadHandler = std::_Bind<oroshi::network::NetworkClient::start()::<lambda(const boost::system::error_code&, std::size_t)>::<lambda(const boost::system::error_code&, std::size_t, std::unique_ptr<char []>&)>(std::_Placeholder<1>, std::_Placeholder<2>, std::unique_ptr<char []>)>; Protocol = boost::asio::ip::tcp; StreamSocketService = boost::asio::stream_socket_service<boost::asio::ip::tcp>]':
server/network/network-client.cpp:56:70:   required from here
/usr/include/boost/asio/basic_stream_socket.hpp:518:64: error: use of deleted function 'std::_Bind<_Functor(_Bound_args ...)>::_Bind(const std::_Bind<_Functor(_Bound_args ...)>&) [with _Functor = oroshi::network::NetworkClient::start()::<lambda(const boost::system::error_code&, std::size_t)>::<lambda(const boost::system::error_code&, std::size_t, std::unique_ptr<char []>&)>; _Bound_args = {std::_Placeholder<1>, std::_Placeholder<2>, std::unique_ptr<char [], std::default_delete<char []> >}; std::_Bind<_Functor(_Bound_args ...)> = std::_Bind<oroshi::network::NetworkClient::start()::<lambda(const boost::system::error_code&, std::size_t)>::<lambda(const boost::system::error_code&, std::size_t, std::unique_ptr<char []>&)>(std::_Placeholder<1>, std::_Placeholder<2>, std::unique_ptr<char []>)>]'
In file included from /usr/include/boost/system/error_code.hpp:23:0,
                 from /usr/include/boost/asio/io_service.hpp:25,
                 from /usr/include/boost/asio/basic_io_object.hpp:19,
                 from /usr/include/boost/asio/basic_socket.hpp:19,
                 from /usr/include/boost/asio/basic_datagram_socket.hpp:20,
                 from /usr/include/boost/asio.hpp:20,
                 from server/network/./network-client.hpp:4,
                 from server/network/network-client.cpp:1:
/usr/include/c++/4.7/functional:1199:7: note: 'std::_Bind<_Functor(_Bound_args ...)>::_Bind(const std::_Bind<_Functor(_Bound_args ...)>&) [with _Functor = oroshi::network::NetworkClient::start()::<lambda(const boost::system::error_code&, std::size_t)>::<lambda(const boost::system::error_code&, std::size_t, std::unique_ptr<char []>&)>; _Bound_args = {std::_Placeholder<1>, std::_Placeholder<2>, std::unique_ptr<char [], std::default_delete<char []> >}; std::_Bind<_Functor(_Bound_args ...)> = std::_Bind<oroshi::network::NetworkClient::start()::<lambda(const boost::system::error_code&, std::size_t)>::<lambda(const boost::system::error_code&, std::size_t, std::unique_ptr<char []>&)>(std::_Placeholder<1>, std::_Placeholder<2>, std::unique_ptr<char []>)>]' is implicitly deleted because the default definition would be ill-formed:
/usr/include/c++/4.7/functional:1199:7: error: use of deleted function 'constexpr std::tuple< <template-parameter-1-1> >::tuple(const std::tuple< <template-parameter-1-1> >&) [with _Elements = {std::_Placeholder<1>, std::_Placeholder<2>, std::unique_ptr<char [], std::default_delete<char []> >}; std::tuple< <template-parameter-1-1> > = std::tuple<std::_Placeholder<1>, std::_Placeholder<2>, std::unique_ptr<char [], std::default_delete<char []> > >]'
In file included from /usr/include/c++/4.7/functional:56:0,
                 from /usr/include/boost/system/error_code.hpp:23,
                 from /usr/include/boost/asio/io_service.hpp:25,
                 from /usr/include/boost/asio/basic_io_object.hpp:19,
                 from /usr/include/boost/asio/basic_socket.hpp:19,
                 from /usr/include/boost/asio/basic_datagram_socket.hpp:20,
                 from /usr/include/boost/asio.hpp:20,
                 from server/network/./network-client.hpp:4,
                 from server/network/network-client.cpp:1:
/usr/include/c++/4.7/tuple:393:17: note: 'constexpr std::tuple< <template-parameter-1-1> >::tuple(const std::tuple< <template-parameter-1-1> >&) [with _Elements = {std::_Placeholder<1>, std::_Placeholder<2>, std::unique_ptr<char [], std::default_delete<char []> >}; std::tuple< <template-parameter-1-1> > = std::tuple<std::_Placeholder<1>, std::_Placeholder<2>, std::unique_ptr<char [], std::default_delete<char []> > >]' is implicitly deleted because the default definition would be ill-formed:
/usr/include/c++/4.7/tuple:393:17: error: use of deleted function 'constexpr std::_Tuple_impl<_Idx, _Head, _Tail ...>::_Tuple_impl(const std::_Tuple_impl<_Idx, _Head, _Tail ...>&) [with long unsigned int _Idx = 0ul; _Head = std::_Placeholder<1>; _Tail = {std::_Placeholder<2>, std::unique_ptr<char [], std::default_delete<char []> >}; std::_Tuple_impl<_Idx, _Head, _Tail ...> = std::_Tuple_impl<0ul, std::_Placeholder<1>, std::_Placeholder<2>, std::unique_ptr<char [], std::default_delete<char []> > >]'
/usr/include/c++/4.7/tuple:250:17: note: 'constexpr std::_Tuple_impl<_Idx, _Head, _Tail ...>::_Tuple_impl(const std::_Tuple_impl<_Idx, _Head, _Tail ...>&) [with long unsigned int _Idx = 0ul; _Head = std::_Placeholder<1>; _Tail = {std::_Placeholder<2>, std::unique_ptr<char [], std::default_delete<char []> >}; std::_Tuple_impl<_Idx, _Head, _Tail ...> = std::_Tuple_impl<0ul, std::_Placeholder<1>, std::_Placeholder<2>, std::unique_ptr<char [], std::default_delete<char []> > >]' is implicitly deleted because the default definition would be ill-formed:
/usr/include/c++/4.7/tuple:250:17: error: use of deleted function 'constexpr std::_Tuple_impl<_Idx, _Head, _Tail ...>::_Tuple_impl(const std::_Tuple_impl<_Idx, _Head, _Tail ...>&) [with long unsigned int _Idx = 1ul; _Head = std::_Placeholder<2>; _Tail = {std::unique_ptr<char [], std::default_delete<char []> >}; std::_Tuple_impl<_Idx, _Head, _Tail ...> = std::_Tuple_impl<1ul, std::_Placeholder<2>, std::unique_ptr<char [], std::default_delete<char []> > >]'
/usr/include/c++/4.7/tuple:250:17: note: 'constexpr std::_Tuple_impl<_Idx, _Head, _Tail ...>::_Tuple_impl(const std::_Tuple_impl<_Idx, _Head, _Tail ...>&) [with long unsigned int _Idx = 1ul; _Head = std::_Placeholder<2>; _Tail = {std::unique_ptr<char [], std::default_delete<char []> >}; std::_Tuple_impl<_Idx, _Head, _Tail ...> = std::_Tuple_impl<1ul, std::_Placeholder<2>, std::unique_ptr<char [], std::default_delete<char []> > >]' is implicitly deleted because the default definition would be ill-formed:
/usr/include/c++/4.7/tuple:250:17: error: use of deleted function 'constexpr std::_Tuple_impl<_Idx, _Head, _Tail ...>::_Tuple_impl(const std::_Tuple_impl<_Idx, _Head, _Tail ...>&) [with long unsigned int _Idx = 2ul; _Head = std::unique_ptr<char []>; _Tail = {}; std::_Tuple_impl<_Idx, _Head, _Tail ...> = std::_Tuple_impl<2ul, std::unique_ptr<char [], std::default_delete<char []> > >]'
/usr/include/c++/4.7/tuple:250:17: note: 'constexpr std::_Tuple_impl<_Idx, _Head, _Tail ...>::_Tuple_impl(const std::_Tuple_impl<_Idx, _Head, _Tail ...>&) [with long unsigned int _Idx = 2ul; _Head = std::unique_ptr<char []>; _Tail = {}; std::_Tuple_impl<_Idx, _Head, _Tail ...> = std::_Tuple_impl<2ul, std::unique_ptr<char [], std::default_delete<char []> > >]' is implicitly deleted because the default definition would be ill-formed:
/usr/include/c++/4.7/tuple:250:17: error: use of deleted function 'std::_Head_base<2ul, std::unique_ptr<char []>, false>::_Head_base(const std::_Head_base<2ul, std::unique_ptr<char []>, false>&)'
/usr/include/c++/4.7/tuple:122:12: note: 'std::_Head_base<2ul, std::unique_ptr<char []>, false>::_Head_base(const std::_Head_base<2ul, std::unique_ptr<char []>, false>&)' is implicitly deleted because the default definition would be ill-formed:
/usr/include/c++/4.7/tuple:122:12: error: use of deleted function 'std::unique_ptr<_Tp [], _Dp>::unique_ptr(const std::unique_ptr<_Tp [], _Dp>&) [with _Tp = char; _Dp = std::default_delete<char []>; std::unique_ptr<_Tp [], _Dp> = std::unique_ptr<char []>]'
In file included from /usr/include/c++/4.7/memory:86:0,
                 from /usr/include/boost/asio/detail/shared_ptr.hpp:21,
                 from /usr/include/boost/asio/detail/socket_ops.hpp:21,
                 from /usr/include/boost/asio/detail/socket_holder.hpp:20,
                 from /usr/include/boost/asio/detail/reactive_socket_accept_op.hpp:24,
                 from /usr/include/boost/asio/detail/reactive_socket_service.hpp:30,
                 from /usr/include/boost/asio/datagram_socket_service.hpp:26,
                 from /usr/include/boost/asio/basic_datagram_socket.hpp:21,
                 from /usr/include/boost/asio.hpp:20,
                 from server/network/./network-client.hpp:4,
                 from server/network/network-client.cpp:1:
/usr/include/c++/4.7/bits/unique_ptr.h:414:7: error: declared here
In file included from /usr/include/boost/asio/impl/io_service.hpp:18:0,
                 from /usr/include/boost/asio/io_service.hpp:767,
                 from /usr/include/boost/asio/basic_io_object.hpp:19,
                 from /usr/include/boost/asio/basic_socket.hpp:19,
                 from /usr/include/boost/asio/basic_datagram_socket.hpp:20,
                 from /usr/include/boost/asio.hpp:20,
                 from server/network/./network-client.hpp:4,
                 from server/network/network-client.cpp:1:
/usr/include/boost/asio/detail/handler_type_requirements.hpp:83:8: error:   initializing argument 1 of 'char (& boost::asio::detail::two_arg_handler_test(Handler, ...))[2] [with Handler = std::_Bind<oroshi::network::NetworkClient::start()::<lambda(const boost::system::error_code&, std::size_t)>::<lambda(const boost::system::error_code&, std::size_t, std::unique_ptr<char []>&)>(std::_Placeholder<1>, std::_Placeholder<2>, std::unique_ptr<char []>)>]'
In file included from /usr/include/boost/asio.hpp:30:0,
                 from server/network/./network-client.hpp:4,
                 from server/network/network-client.cpp:1:
/usr/include/boost/asio/basic_stream_socket.hpp:515:5: error: static assertion failed: ReadHandler type requirements not met
/usr/include/boost/asio/basic_stream_socket.hpp:515:57: error: use of deleted function 'std::_Bind<_Functor(_Bound_args ...)>::_Bind(const std::_Bind<_Functor(_Bound_args ...)>&) [with _Functor = oroshi::network::NetworkClient::start()::<lambda(const boost::system::error_code&, std::size_t)>::<lambda(const boost::system::error_code&, std::size_t, std::unique_ptr<char []>&)>; _Bound_args = {std::_Placeholder<1>, std::_Placeholder<2>, std::unique_ptr<char [], std::default_delete<char []> >}; std::_Bind<_Functor(_Bound_args ...)> = std::_Bind<oroshi::network::NetworkClient::start()::<lambda(const boost::system::error_code&, std::size_t)>::<lambda(const boost::system::error_code&, std::size_t, std::unique_ptr<char []>&)>(std::_Placeholder<1>, std::_Placeholder<2>, std::unique_ptr<char []>)>]'
In file included from /usr/include/boost/asio/impl/io_service.hpp:18:0,
                 from /usr/include/boost/asio/io_service.hpp:767,
                 from /usr/include/boost/asio/basic_io_object.hpp:19,
                 from /usr/include/boost/asio/basic_socket.hpp:19,
                 from /usr/include/boost/asio/basic_datagram_socket.hpp:20,
                 from /usr/include/boost/asio.hpp:20,
                 from server/network/./network-client.hpp:4,
                 from server/network/network-client.cpp:1:
/usr/include/boost/asio/detail/handler_type_requirements.hpp:95:26: error:   initializing argument 1 of 'T& boost::asio::detail::lvref(T) [with T = std::_Bind<oroshi::network::NetworkClient::start()::<lambda(const boost::system::error_code&, std::size_t)>::<lambda(const boost::system::error_code&, std::size_t, std::unique_ptr<char []>&)>(std::_Placeholder<1>, std::_Placeholder<2>, std::unique_ptr<char []>)>]'
In file included from /usr/include/boost/asio.hpp:30:0,
                 from server/network/./network-client.hpp:4,
                 from server/network/network-client.cpp:1:
/usr/include/boost/asio/basic_stream_socket.hpp:515:57: error: use of deleted function 'std::_Bind<_Functor(_Bound_args ...)>::_Bind(const std::_Bind<_Functor(_Bound_args ...)>&) [with _Functor = oroshi::network::NetworkClient::start()::<lambda(const boost::system::error_code&, std::size_t)>::<lambda(const boost::system::error_code&, std::size_t, std::unique_ptr<char []>&)>; _Bound_args = {std::_Placeholder<1>, std::_Placeholder<2>, std::unique_ptr<char [], std::default_delete<char []> >}; std::_Bind<_Functor(_Bound_args ...)> = std::_Bind<oroshi::network::NetworkClient::start()::<lambda(const boost::system::error_code&, std::size_t)>::<lambda(const boost::system::error_code&, std::size_t, std::unique_ptr<char []>&)>(std::_Placeholder<1>, std::_Placeholder<2>, std::unique_ptr<char []>)>]'
In file included from /usr/include/boost/asio/impl/io_service.hpp:18:0,
                 from /usr/include/boost/asio/io_service.hpp:767,
                 from /usr/include/boost/asio/basic_io_object.hpp:19,
                 from /usr/include/boost/asio/basic_socket.hpp:19,
                 from /usr/include/boost/asio/basic_datagram_socket.hpp:20,
                 from /usr/include/boost/asio.hpp:20,
                 from server/network/./network-client.hpp:4,
                 from server/network/network-client.cpp:1:
/usr/include/boost/asio/detail/handler_type_requirements.hpp:96:32: error:   initializing argument 1 of 'const T& boost::asio::detail::clvref(T) [with T = std::_Bind<oroshi::network::NetworkClient::start()::<lambda(const boost::system::error_code&, std::size_t)>::<lambda(const boost::system::error_code&, std::size_t, std::unique_ptr<char []>&)>(std::_Placeholder<1>, std::_Placeholder<2>, std::unique_ptr<char []>)>]'
In file included from /usr/include/boost/asio.hpp:30:0,
                 from server/network/./network-client.hpp:4,
                 from server/network/network-client.cpp:1:
/usr/include/boost/asio/basic_stream_socket.hpp:515:57: error: use of deleted function 'std::_Bind<_Functor(_Bound_args ...)>::_Bind(const std::_Bind<_Functor(_Bound_args ...)>&) [with _Functor = oroshi::network::NetworkClient::start()::<lambda(const boost::system::error_code&, std::size_t)>::<lambda(const boost::system::error_code&, std::size_t, std::unique_ptr<char []>&)>; _Bound_args = {std::_Placeholder<1>, std::_Placeholder<2>, std::unique_ptr<char [], std::default_delete<char []> >}; std::_Bind<_Functor(_Bound_args ...)> = std::_Bind<oroshi::network::NetworkClient::start()::<lambda(const boost::system::error_code&, std::size_t)>::<lambda(const boost::system::error_code&, std::size_t, std::unique_ptr<char []>&)>(std::_Placeholder<1>, std::_Placeholder<2>, std::unique_ptr<char []>)>]'
In file included from /usr/include/boost/asio/impl/io_service.hpp:18:0,
                 from /usr/include/boost/asio/io_service.hpp:767,
                 from /usr/include/boost/asio/basic_io_object.hpp:19,
                 from /usr/include/boost/asio/basic_socket.hpp:19,
                 from /usr/include/boost/asio/basic_datagram_socket.hpp:20,
                 from /usr/include/boost/asio.hpp:20,
                 from server/network/./network-client.hpp:4,
                 from server/network/network-client.cpp:1:
/usr/include/boost/asio/detail/handler_type_requirements.hpp:97:28: error:   initializing argument 1 of 'char boost::asio::detail::argbyv(T) [with T = std::_Bind<oroshi::network::NetworkClient::start()::<lambda(const boost::system::error_code&, std::size_t)>::<lambda(const boost::system::error_code&, std::size_t, std::unique_ptr<char []>&)>(std::_Placeholder<1>, std::_Placeholder<2>, std::unique_ptr<char []>)>]'
In file included from /usr/include/c++/4.7/functional:56:0,
                 from /usr/include/boost/system/error_code.hpp:23,
                 from /usr/include/boost/asio/io_service.hpp:25,
                 from /usr/include/boost/asio/basic_io_object.hpp:19,
                 from /usr/include/boost/asio/basic_socket.hpp:19,
                 from /usr/include/boost/asio/basic_datagram_socket.hpp:20,
                 from /usr/include/boost/asio.hpp:20,
                 from server/network/./network-client.hpp:4,
                 from server/network/network-client.cpp:1:
/usr/include/c++/4.7/tuple: In instantiation of 'constexpr std::_Head_base<_Idx, _Head, false>::_Head_base(const _Head&) [with long unsigned int _Idx = 2ul; _Head = std::unique_ptr<char []>]':
/usr/include/c++/4.7/tuple:241:44:   recursively required from 'constexpr std::_Tuple_impl<_Idx, _Head, _Tail ...>::_Tuple_impl(const _Head&, const _Tail& ...) [with long unsigned int _Idx = 1ul; _Head = std::_Placeholder<2>; _Tail = {std::unique_ptr<char [], std::default_delete<char []> >}]'
/usr/include/c++/4.7/tuple:241:44:   required from 'constexpr std::_Tuple_impl<_Idx, _Head, _Tail ...>::_Tuple_impl(const _Head&, const _Tail& ...) [with long unsigned int _Idx = 0ul; _Head = std::_Placeholder<1>; _Tail = {std::_Placeholder<2>, std::unique_ptr<char [], std::default_delete<char []> >}]'
/usr/include/c++/4.7/tuple:384:33:   required from 'constexpr std::tuple< <template-parameter-1-1> >::tuple(const _Elements& ...) [with _Elements = {std::_Placeholder<1>, std::_Placeholder<2>, std::unique_ptr<char [], std::default_delete<char []> >}]'
/usr/include/c++/4.7/functional:1196:70:   required from 'std::_Bind<_Functor(_Bound_args ...)>::_Bind(_Functor&&, _Args&& ...) [with _Args = {const std::_Placeholder<1>&, const std::_Placeholder<2>&, std::unique_ptr<char [], std::default_delete<char []> >&}; _Functor = oroshi::network::NetworkClient::start()::<lambda(const boost::system::error_code&, std::size_t)>::<lambda(const boost::system::error_code&, std::size_t, std::unique_ptr<char []>&)>; _Bound_args = {std::_Placeholder<1>, std::_Placeholder<2>, std::unique_ptr<char [], std::default_delete<char []> >}]'
/usr/include/c++/4.7/functional:1527:42:   required from 'typename std::_Bind_helper<std::__is_socketlike<_Func>::value, _Func, _BoundArgs ...>::type std::bind(_Func&&, _BoundArgs&& ...) [with _Func = oroshi::network::NetworkClient::start()::<lambda(const boost::system::error_code&, std::size_t)>::<lambda(const boost::system::error_code&, std::size_t, std::unique_ptr<char []>&)>; _BoundArgs = {const std::_Placeholder<1>&, const std::_Placeholder<2>&, std::unique_ptr<char [], std::default_delete<char []> >&}; typename std::_Bind_helper<std::__is_socketlike<_Func>::value, _Func, _BoundArgs ...>::type = std::_Bind<oroshi::network::NetworkClient::start()::<lambda(const boost::system::error_code&, std::size_t)>::<lambda(const boost::system::error_code&, std::size_t, std::unique_ptr<char []>&)>(std::_Placeholder<1>, std::_Placeholder<2>, std::unique_ptr<char []>)>]'
server/network/network-client.cpp:56:69:   required from here
/usr/include/c++/4.7/tuple:128:25: error: use of deleted function 'std::unique_ptr<_Tp [], _Dp>::unique_ptr(const std::unique_ptr<_Tp [], _Dp>&) [with _Tp = char; _Dp = std::default_delete<char []>; std::unique_ptr<_Tp [], _Dp> = std::unique_ptr<char []>]'
In file included from /usr/include/c++/4.7/memory:86:0,
                 from /usr/include/boost/asio/detail/shared_ptr.hpp:21,
                 from /usr/include/boost/asio/detail/socket_ops.hpp:21,
                 from /usr/include/boost/asio/detail/socket_holder.hpp:20,
                 from /usr/include/boost/asio/detail/reactive_socket_accept_op.hpp:24,
                 from /usr/include/boost/asio/detail/reactive_socket_service.hpp:30,
                 from /usr/include/boost/asio/datagram_socket_service.hpp:26,
                 from /usr/include/boost/asio/basic_datagram_socket.hpp:21,
                 from /usr/include/boost/asio.hpp:20,
                 from server/network/./network-client.hpp:4,
                 from server/network/network-client.cpp:1:
/usr/include/c++/4.7/bits/unique_ptr.h:414:7: error: declared here
4

0 回答 0