Workaround for boost::asio::basic_streambuf type check

This commit is contained in:
Vinnie Falco
2017-05-24 15:14:07 -07:00
parent e58fce380c
commit f0349efddc
3 changed files with 24 additions and 5 deletions

View File

@@ -1,3 +1,9 @@
Version 45
* Workaround for boost::asio::basic_streambuf type check
--------------------------------------------------------------------------------
Version 44
* Use BOOST_THROW_EXCEPTION

View File

@@ -345,4 +345,14 @@ public:
} // detail
} // beast
namespace boost {
namespace asio {
// for is_dynamic_buffer
template<class Allocator>
class basic_streambuf;
} // asio
} // boost
#endif

View File

@@ -56,17 +56,12 @@ struct is_dynamic_buffer : std::false_type {};
template<class T>
struct is_dynamic_buffer<T, beast::detail::void_t<
decltype(
// expressions
std::declval<std::size_t&>() =
std::declval<T const&>().size(),
std::declval<std::size_t&>() =
std::declval<T const&>().max_size(),
#if 0
// This check is skipped because boost::asio
// types are not up to date with net-ts.
std::declval<std::size_t&>() =
std::declval<T const&>().capacity(),
#endif
std::declval<T&>().commit(std::declval<std::size_t>()),
std::declval<T&>().consume(std::declval<std::size_t>()),
(void)0)>> : std::integral_constant<bool,
@@ -82,6 +77,14 @@ struct is_dynamic_buffer<T, beast::detail::void_t<
>
{
};
// Special case for Boost.Asio which doesn't adhere to
// net-ts but still provides a read_size_helper so things work
template<class Allocator>
struct is_dynamic_buffer<
boost::asio::basic_streambuf<Allocator>> : std::true_type
{
};
#endif
//------------------------------------------------------------------------------