boost::span rvalue is not supported by asio::buffers
- Lenguaje dominante
- C++
- Estrellas
- 1.6k
- Forks
- 485
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
I have a function that returns a buffer as a span to read the data from socket:
```cpp
boost::span getRecvBuffer();
```
When I call `tcp::socket::async_receive(asio::buffer(getRecvBuffer()))`,
```cpp
socket_.async_receive(asio::buffer(getRecvBuffer()), [](auto&&...) {});
```
... I get an error:
```
error: no matching function for call to ‘boost::asio::mutable_buffer::mutable_buffer(const boost::asio::const_buffers_1&)’
```
The weird thing is that following code compiles:
```cpp
auto b1 = asio::buffer(getRecvBuffer());
```
Following code compiles too:
```cpp
auto buf = client.socketRecvBuffer_.recvBuffer();
socket_.async_receive(asio::buffer(buf), [](auto&&...) {});
```
It seems in order to create a `mutable_buffer`, I need a lvalue for the buffer, which makes sense in case of `std::vector`, but it does not make sense for `boost::span`.
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Evaluación
Este issue todavía no se ha evaluado.