mirror of
https://github.com/boostorg/beast.git
synced 2025-07-31 13:27:33 +02:00
@ -3,6 +3,7 @@ Version 44
|
||||
* Use BOOST_THROW_EXCEPTION
|
||||
* Tidy up read_size_helper and dynamic buffers
|
||||
* Require Boost 1.58.0 or later
|
||||
* Tidy up and make get_lowest_layer public
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
@ -38,6 +38,11 @@ diagnostics.
|
||||
|
||||
[table Type Traits
|
||||
[[Name][Description]]
|
||||
[[
|
||||
[link beast.ref.get_lowest_layer `get_lowest_layer`]
|
||||
][
|
||||
Returns `T::lowest_layer_type` if it exists, else returns `T`.
|
||||
]]
|
||||
[[
|
||||
[link beast.ref.has_get_io_service `has_get_io_service`]
|
||||
][
|
||||
|
@ -139,6 +139,7 @@ Asio library and the ideas upon which Beast is built.
|
||||
Beast would not be possible without the considerable time and patience
|
||||
contributed by David Schwartz, Edward Hennis, Howard Hinnant, Miguel Portilla,
|
||||
Nikolaos Bougalis, Scott Determan, Scott Schurr, and Ripple Labs for
|
||||
supporting its early development.
|
||||
supporting its early development. Also thanks to Agustín Bergé, Glen Fernandes
|
||||
and Peter Dimov for putting up with my endless C++ questions on Slack.
|
||||
|
||||
[endsect]
|
||||
|
@ -194,6 +194,7 @@
|
||||
<entry valign="top">
|
||||
<bridgehead renderas="sect3">Type Traits</bridgehead>
|
||||
<simplelist type="vert" columns="1">
|
||||
<member><link linkend="beast.ref.get_lowest_layer">get_lowest_layer</link></member>
|
||||
<member><link linkend="beast.ref.has_get_io_service">has_get_io_service</link></member>
|
||||
<member><link linkend="beast.ref.is_async_read_stream">is_async_read_stream</link></member>
|
||||
<member><link linkend="beast.ref.is_async_write_stream">is_async_write_stream</link></member>
|
||||
|
@ -36,8 +36,7 @@ public:
|
||||
typename std::remove_reference<NextLayer>::type;
|
||||
|
||||
using lowest_layer_type =
|
||||
typename beast::detail::get_lowest_layer<
|
||||
next_layer_type>::type;
|
||||
typename get_lowest_layer<next_layer_type>::type;
|
||||
|
||||
fail_stream(fail_stream&&) = delete;
|
||||
fail_stream(fail_stream const&) = delete;
|
||||
|
@ -108,12 +108,7 @@ public:
|
||||
|
||||
/// The type of the lowest layer.
|
||||
using lowest_layer_type =
|
||||
#if BEAST_DOXYGEN
|
||||
implementation_defined;
|
||||
#else
|
||||
typename detail::get_lowest_layer<
|
||||
next_layer_type>::type;
|
||||
#endif
|
||||
typename get_lowest_layer<next_layer_type>::type;
|
||||
|
||||
/** Move constructor.
|
||||
|
||||
|
@ -1,20 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2013-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#ifndef BEAST_DETAIL_GET_LOWEST_LAYER_HPP
|
||||
#define BEAST_DETAIL_GET_LOWEST_LAYER_HPP
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
namespace beast {
|
||||
namespace detail {
|
||||
|
||||
|
||||
} // detail
|
||||
} // beast
|
||||
|
||||
#endif
|
@ -122,39 +122,6 @@ struct is_invocable<C, R(A...)>
|
||||
};
|
||||
/** @} */
|
||||
|
||||
template<class T>
|
||||
class has_lowest_layer
|
||||
{
|
||||
template<class U, class R =
|
||||
typename U::lowest_layer_type>
|
||||
static std::true_type check(int);
|
||||
template<class>
|
||||
static std::false_type check(...);
|
||||
using type = decltype(check<T>(0));
|
||||
public:
|
||||
static bool constexpr value = type::value;
|
||||
};
|
||||
|
||||
template<class T, bool B>
|
||||
struct maybe_get_lowest_layer
|
||||
{
|
||||
using type = T;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct maybe_get_lowest_layer<T, true>
|
||||
{
|
||||
using type = typename T::lowest_layer_type;
|
||||
};
|
||||
|
||||
// Returns T::lowest_layer_type if it exists, else T
|
||||
template<class T>
|
||||
struct get_lowest_layer
|
||||
{
|
||||
using type = typename maybe_get_lowest_layer<T,
|
||||
has_lowest_layer<T>::value>::type;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//
|
||||
|
@ -15,6 +15,12 @@
|
||||
|
||||
namespace beast {
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
// Buffer concepts
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/// Determine if `T` meets the requirements of @b ConstBufferSequence.
|
||||
template<class T>
|
||||
#if BEAST_DOXYGEN
|
||||
@ -50,6 +56,29 @@ struct is_mutable_buffer_sequence :
|
||||
{
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
// Handler concepts
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/// Determine if `T` meets the requirements of @b CompletionHandler.
|
||||
template<class T, class Signature>
|
||||
#if BEAST_DOXYGEN
|
||||
using is_completion_handler = std::integral_constant<bool, ...>;
|
||||
#else
|
||||
using is_completion_handler = std::integral_constant<bool,
|
||||
std::is_copy_constructible<typename std::decay<T>::type>::value &&
|
||||
detail::is_invocable<T, Signature>::value>;
|
||||
#endif
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
// Stream concepts
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/// Determine if `T` has the `get_io_service` member.
|
||||
template<class T>
|
||||
#if BEAST_DOXYGEN
|
||||
@ -58,6 +87,25 @@ struct has_get_io_service : std::integral_constant<bool, ...>{};
|
||||
using has_get_io_service = typename detail::has_get_io_service<T>::type;
|
||||
#endif
|
||||
|
||||
/// Returns `T::lowest_layer_type` if it exists, else `T`
|
||||
#if BEAST_DOXYGEN
|
||||
template<class T>
|
||||
struct get_lowest_layer;
|
||||
#else
|
||||
template<class T, class = void>
|
||||
struct get_lowest_layer
|
||||
{
|
||||
using type = T;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct get_lowest_layer<T, detail::void_t<
|
||||
typename T::lowest_layer_type>>
|
||||
{
|
||||
using type = typename T::lowest_layer_type;
|
||||
};
|
||||
#endif
|
||||
|
||||
/// Determine if `T` meets the requirements of @b AsyncReadStream.
|
||||
template<class T>
|
||||
#if BEAST_DOXYGEN
|
||||
@ -108,16 +156,6 @@ using is_sync_stream = std::integral_constant<bool,
|
||||
is_sync_read_stream<T>::value && is_sync_write_stream<T>::value>;
|
||||
#endif
|
||||
|
||||
/// Determine if `T` meets the requirements of @b CompletionHandler.
|
||||
template<class T, class Signature>
|
||||
#if BEAST_DOXYGEN
|
||||
using is_completion_handler = std::integral_constant<bool, ...>;
|
||||
#else
|
||||
using is_completion_handler = std::integral_constant<bool,
|
||||
std::is_copy_constructible<typename std::decay<T>::type>::value &&
|
||||
detail::is_invocable<T, Signature>::value>;
|
||||
#endif
|
||||
|
||||
} // beast
|
||||
|
||||
#endif
|
||||
|
@ -107,12 +107,7 @@ public:
|
||||
|
||||
/// The type of the lowest layer.
|
||||
using lowest_layer_type =
|
||||
#if BEAST_DOXYGEN
|
||||
implementation_defined;
|
||||
#else
|
||||
typename beast::detail::get_lowest_layer<
|
||||
next_layer_type>::type;
|
||||
#endif
|
||||
typename get_lowest_layer<next_layer_type>::type;
|
||||
|
||||
/** Move-construct a stream.
|
||||
|
||||
|
@ -86,11 +86,6 @@ struct F4
|
||||
get_lowest_layer<next_layer_type>::type;
|
||||
};
|
||||
|
||||
static_assert(! has_lowest_layer<F1>::value, "");
|
||||
static_assert(! has_lowest_layer<F2>::value, "");
|
||||
static_assert(has_lowest_layer<F3<F1>>::value, "");
|
||||
static_assert(has_lowest_layer<F4<F3<F2>>>::value, "");
|
||||
|
||||
static_assert(std::is_same<
|
||||
get_lowest_layer<F1>::type, F1>::value, "");
|
||||
|
||||
|
Reference in New Issue
Block a user