chriskohlhoff / asio

Asio C++ Library
http://think-async.com/Asio
4.89k stars 1.21k forks source link

BOOST_ASIO_REBIND_ALLOC question #714

Open ghost opened 3 years ago

ghost commented 3 years ago

@ssfang commented on Aug 31, 2019, 2:52 PM UTC:

Hi,

I‘m trying boost aiso examples on my andoird mobile phone.

Unfortunately!

When I compiled the time_t_timer example, using c4doird app by g++ -std=c++17 on android, the g++ complained:

no member allocate and deallocate

at the line 190 in handler_alloc_helpers.hpp, and I found it occurred when compiling the parameter of async_wait:

    timer.async_wait(
        [](const boost::system::error_code& /*error*/)
        {
          std::cout << "timeout\n";
        });

After I

  1. updated the line 59 in memory.hpp to:

    typename std::allocator_traits<alloc>::template rebind_alloc<t>::other

or,

  1. added #define BOOST_ASIO_DISABLE_CXX11_ALLOCATORS before #include <boost/asio.hpp>,

The problem disappeared!

Is there a problem here?

https://github.com/boostorg/asio/blob/master/include/boost/asio/detail/memory.hpp

This issue was moved by chriskohlhoff from boostorg/asio#275.

ghost commented 3 years ago

@djarek commented on Sep 4, 2019, 4:33 PM UTC:

At first glance, it seems that there is a bug and your first solution should be applied.