Use separate SFINAE constraints for write and async_write.

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

View File

@ -118,7 +118,9 @@ std::size_t write(SyncWriteStream& 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(
@ -135,7 +137,9 @@ inline std::size_t write(SyncWriteStream& 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;
@ -152,7 +156,9 @@ inline std::size_t write(SyncWriteStream& 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 write(s, ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers),
@ -166,7 +172,9 @@ inline std::size_t write(SyncWriteStream& 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;
@ -782,7 +790,9 @@ async_write(AsyncWriteStream& s,
ASIO_MOVE_ARG(WriteHandler) 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_write(s,
@ -802,7 +812,9 @@ async_write(AsyncWriteStream& s,
ASIO_MOVE_ARG(WriteHandler) 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<WriteHandler,

View File

@ -257,7 +257,9 @@ std::size_t write(SyncWriteStream& 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);
/// Write all of the supplied data to a stream before returning.
@ -293,7 +295,9 @@ std::size_t write(SyncWriteStream& 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);
/// Write a certain amount of data to a stream before returning.
@ -339,7 +343,9 @@ std::size_t write(SyncWriteStream& 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);
/// Write a certain amount of data to a stream before returning.
@ -386,7 +392,9 @@ std::size_t write(SyncWriteStream& 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)
@ -907,7 +915,9 @@ async_write(AsyncWriteStream& s,
typename AsyncWriteStream::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 write a certain amount of data to a
@ -979,7 +989,9 @@ async_write(AsyncWriteStream& s,
ASIO_MOVE_ARG(WriteHandler) handler,
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)