Use separate SFINAE constraints for read and async_read.

This commit is contained in:
Christopher Kohlhoff 2021-03-04 09:44:32 +11:00
parent bb7c4d4d54
commit 2cdf01144f
2 changed files with 36 additions and 12 deletions

View File

@ -120,7 +120,9 @@ std::size_t read(SyncReadStream& s,
CompletionCondition completion_condition, asio::error_code& ec,
typename constraint<
is_dynamic_buffer_v1<typename decay<DynamicBuffer_v1>::type>::value
&& !is_dynamic_buffer_v2<typename decay<DynamicBuffer_v1>::type>::value
>::type,
typename constraint<
!is_dynamic_buffer_v2<typename decay<DynamicBuffer_v1>::type>::value
>::type)
{
typename decay<DynamicBuffer_v1>::type b(
@ -152,7 +154,9 @@ inline std::size_t read(SyncReadStream& s,
ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
typename constraint<
is_dynamic_buffer_v1<typename decay<DynamicBuffer_v1>::type>::value
&& !is_dynamic_buffer_v2<typename decay<DynamicBuffer_v1>::type>::value
>::type,
typename constraint<
!is_dynamic_buffer_v2<typename decay<DynamicBuffer_v1>::type>::value
>::type)
{
asio::error_code ec;
@ -168,7 +172,9 @@ inline std::size_t read(SyncReadStream& s,
asio::error_code& ec,
typename constraint<
is_dynamic_buffer_v1<typename decay<DynamicBuffer_v1>::type>::value
&& !is_dynamic_buffer_v2<typename decay<DynamicBuffer_v1>::type>::value
>::type,
typename constraint<
!is_dynamic_buffer_v2<typename decay<DynamicBuffer_v1>::type>::value
>::type)
{
return read(s, ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers),
@ -182,7 +188,9 @@ inline std::size_t read(SyncReadStream& s,
CompletionCondition completion_condition,
typename constraint<
is_dynamic_buffer_v1<typename decay<DynamicBuffer_v1>::type>::value
&& !is_dynamic_buffer_v2<typename decay<DynamicBuffer_v1>::type>::value
>::type,
typename constraint<
!is_dynamic_buffer_v2<typename decay<DynamicBuffer_v1>::type>::value
>::type)
{
asio::error_code ec;
@ -846,7 +854,9 @@ async_read(AsyncReadStream& s,
ASIO_MOVE_ARG(ReadHandler) handler,
typename constraint<
is_dynamic_buffer_v1<typename decay<DynamicBuffer_v1>::type>::value
&& !is_dynamic_buffer_v2<typename decay<DynamicBuffer_v1>::type>::value
>::type,
typename constraint<
!is_dynamic_buffer_v2<typename decay<DynamicBuffer_v1>::type>::value
>::type)
{
return async_read(s,
@ -866,7 +876,9 @@ async_read(AsyncReadStream& s,
ASIO_MOVE_ARG(ReadHandler) handler,
typename constraint<
is_dynamic_buffer_v1<typename decay<DynamicBuffer_v1>::type>::value
&& !is_dynamic_buffer_v2<typename decay<DynamicBuffer_v1>::type>::value
>::type,
typename constraint<
!is_dynamic_buffer_v2<typename decay<DynamicBuffer_v1>::type>::value
>::type)
{
return async_initiate<ReadHandler,

View File

@ -257,7 +257,9 @@ std::size_t read(SyncReadStream& s,
ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
typename constraint<
is_dynamic_buffer_v1<typename decay<DynamicBuffer_v1>::type>::value
&& !is_dynamic_buffer_v2<typename decay<DynamicBuffer_v1>::type>::value
>::type = 0,
typename constraint<
!is_dynamic_buffer_v2<typename decay<DynamicBuffer_v1>::type>::value
>::type = 0);
/// Attempt to read a certain amount of data from a stream before returning.
@ -292,7 +294,9 @@ std::size_t read(SyncReadStream& s,
asio::error_code& ec,
typename constraint<
is_dynamic_buffer_v1<typename decay<DynamicBuffer_v1>::type>::value
&& !is_dynamic_buffer_v2<typename decay<DynamicBuffer_v1>::type>::value
>::type = 0,
typename constraint<
!is_dynamic_buffer_v2<typename decay<DynamicBuffer_v1>::type>::value
>::type = 0);
/// Attempt to read a certain amount of data from a stream before returning.
@ -338,7 +342,9 @@ std::size_t read(SyncReadStream& s,
CompletionCondition completion_condition,
typename constraint<
is_dynamic_buffer_v1<typename decay<DynamicBuffer_v1>::type>::value
&& !is_dynamic_buffer_v2<typename decay<DynamicBuffer_v1>::type>::value
>::type = 0,
typename constraint<
!is_dynamic_buffer_v2<typename decay<DynamicBuffer_v1>::type>::value
>::type = 0);
/// Attempt to read a certain amount of data from a stream before returning.
@ -385,7 +391,9 @@ std::size_t read(SyncReadStream& s,
CompletionCondition completion_condition, asio::error_code& ec,
typename constraint<
is_dynamic_buffer_v1<typename decay<DynamicBuffer_v1>::type>::value
&& !is_dynamic_buffer_v2<typename decay<DynamicBuffer_v1>::type>::value
>::type = 0,
typename constraint<
!is_dynamic_buffer_v2<typename decay<DynamicBuffer_v1>::type>::value
>::type = 0);
#if !defined(ASIO_NO_EXTENSIONS)
@ -920,7 +928,9 @@ async_read(AsyncReadStream& s,
typename AsyncReadStream::executor_type),
typename constraint<
is_dynamic_buffer_v1<typename decay<DynamicBuffer_v1>::type>::value
&& !is_dynamic_buffer_v2<typename decay<DynamicBuffer_v1>::type>::value
>::type = 0,
typename constraint<
!is_dynamic_buffer_v2<typename decay<DynamicBuffer_v1>::type>::value
>::type = 0);
/// Start an asynchronous operation to read a certain amount of data from a
@ -997,7 +1007,9 @@ async_read(AsyncReadStream& s,
typename AsyncReadStream::executor_type),
typename constraint<
is_dynamic_buffer_v1<typename decay<DynamicBuffer_v1>::type>::value
&& !is_dynamic_buffer_v2<typename decay<DynamicBuffer_v1>::type>::value
>::type = 0,
typename constraint<
!is_dynamic_buffer_v2<typename decay<DynamicBuffer_v1>::type>::value
>::type = 0);
#if !defined(ASIO_NO_EXTENSIONS)