forked from boostorg/beast
@@ -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.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user