Fix prepare_buffers value_type:

This fixes a bug where calling prepare_buffers on a buffer
sequence whose value_type is not const_buffer or mutable_buffer
causes compilation errors.

The documentation is also tidied up.
This commit is contained in:
Vinnie Falco
2017-07-20 08:12:13 -07:00
parent aa8e7432c2
commit 08d8a2ae35
3 changed files with 67 additions and 38 deletions
+6 -2
View File
@@ -50,8 +50,12 @@ class prepared_buffers<BufferSequence>::const_iterator
typename BufferSequence::const_iterator it_;
public:
using value_type =
typename std::iterator_traits<iter_type>::value_type;
using value_type = typename std::conditional<
std::is_convertible<typename
std::iterator_traits<iter_type>::value_type,
boost::asio::mutable_buffer>::value,
boost::asio::mutable_buffer,
boost::asio::const_buffer>::type;
using pointer = value_type const*;
using reference = value_type;
using difference_type = std::ptrdiff_t;