mirror of
https://github.com/boostorg/beast.git
synced 2025-07-29 20:37:31 +02:00
get_lowest_layer is a type alias:
fix #941, fix #1016 `get_lowest_layer` is now a type alias for the lowest layer instead of a struct with a nested type. Actions required: * Replace instances of `typename get_lowest_layer<T>::type` with `get_lowest_layer<T>`.
This commit is contained in:
10
CHANGELOG.md
10
CHANGELOG.md
@ -7,6 +7,16 @@ Version 158:
|
||||
* DynamicBuffer input areas are not mutable
|
||||
* Tidy up some documentation
|
||||
|
||||
API Changes:
|
||||
|
||||
* get_lowest_layer is a type alias
|
||||
|
||||
Actions required:
|
||||
|
||||
* Replace instances of `typename get_lowest_layer<T>::type`
|
||||
with `get_lowest_layer<T>`.
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Version 157:
|
||||
|
@ -160,7 +160,9 @@ to update to the latest Boost release.
|
||||
Actions required: do not attempt to write to input areas of dynamic
|
||||
buffers.
|
||||
|
||||
|
||||
* ([\issue 941]) `get_lowest_layer` is now a type alias.
|
||||
Actions required: Replace instances of `typename get_lowest_layer<T>::type`
|
||||
with `get_lowest_layer<T>`.
|
||||
|
||||
[heading Boost 1.66]
|
||||
|
||||
|
@ -111,8 +111,7 @@ public:
|
||||
typename std::remove_reference<Stream>::type;
|
||||
|
||||
/// The type of the lowest layer.
|
||||
using lowest_layer_type =
|
||||
typename get_lowest_layer<next_layer_type>::type;
|
||||
using lowest_layer_type = get_lowest_layer<next_layer_type>;
|
||||
|
||||
/** Move constructor.
|
||||
|
||||
|
@ -255,6 +255,21 @@ max_all(U0 u0, U1 u1, UN... un)
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
template<class T, class = void>
|
||||
struct get_lowest_layer_helper
|
||||
{
|
||||
using type = T;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct get_lowest_layer_helper<T,
|
||||
void_t<typename T::lowest_layer_type>>
|
||||
{
|
||||
using type = typename T::lowest_layer_type;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//
|
||||
// buffer concepts
|
||||
//
|
||||
|
@ -122,10 +122,10 @@ struct has_get_executor<T, beast::detail::void_t<decltype(
|
||||
(void)0)>> : std::true_type {};
|
||||
#endif
|
||||
|
||||
/** Returns `T::lowest_layer_type` if it exists, else `T`
|
||||
/** Alias for `T::lowest_layer_type` if it exists, else `T`
|
||||
|
||||
This will contain a nested `type` equal to `T::lowest_layer_type`
|
||||
if it exists, else `type` will be equal to `T`.
|
||||
This will be a type alias for `T::lowest_layer_type`
|
||||
if it exists, else it will be an alias for `T`.
|
||||
|
||||
@par Example
|
||||
|
||||
@ -136,7 +136,7 @@ struct has_get_executor<T, beast::detail::void_t<decltype(
|
||||
struct stream_wrapper
|
||||
{
|
||||
using next_layer_type = typename std::remove_reference<Stream>::type;
|
||||
using lowest_layer_type = typename get_lowest_layer<stream_type>::type;
|
||||
using lowest_layer_type = get_lowest_layer<stream_type>;
|
||||
};
|
||||
@endcode
|
||||
|
||||
@ -146,25 +146,15 @@ struct has_get_executor<T, beast::detail::void_t<decltype(
|
||||
/// Alias for `std::true_type` if `T` wraps another stream
|
||||
template<class T>
|
||||
using is_stream_wrapper : std::integral_constant<bool,
|
||||
! std::is_same<T, typename get_lowest_layer<T>::type>::value> {};
|
||||
! std::is_same<T, get_lowest_layer<T>>::value> {};
|
||||
@endcode
|
||||
*/
|
||||
#if BOOST_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;
|
||||
};
|
||||
using get_lowest_layer = typename detail::get_lowest_layer_helper<T>::type;
|
||||
#endif
|
||||
|
||||
/** Determine if `T` meets the requirements of @b AsyncReadStream.
|
||||
|
@ -225,8 +225,7 @@ public:
|
||||
typename std::remove_reference<NextLayer>::type;
|
||||
|
||||
/// The type of the lowest layer.
|
||||
using lowest_layer_type =
|
||||
typename get_lowest_layer<next_layer_type>::type;
|
||||
using lowest_layer_type = get_lowest_layer<next_layer_type>;
|
||||
|
||||
/// The type of the executor associated with the object.
|
||||
using executor_type = typename next_layer_type::executor_type;
|
||||
|
@ -71,8 +71,7 @@ struct F3
|
||||
using next_layer_type =
|
||||
typename std::remove_reference<F>::type;
|
||||
|
||||
using lowest_layer_type = typename
|
||||
get_lowest_layer<next_layer_type>::type;
|
||||
using lowest_layer_type = get_lowest_layer<next_layer_type>;
|
||||
};
|
||||
|
||||
template<class F>
|
||||
@ -81,18 +80,18 @@ struct F4
|
||||
using next_layer_type =
|
||||
typename std::remove_reference<F>::type;
|
||||
|
||||
using lowest_layer_type = typename
|
||||
get_lowest_layer<next_layer_type>::type;
|
||||
using lowest_layer_type =
|
||||
get_lowest_layer<next_layer_type>;
|
||||
};
|
||||
|
||||
BOOST_STATIC_ASSERT(std::is_same<get_lowest_layer<F1>::type, F1>::value);
|
||||
BOOST_STATIC_ASSERT(std::is_same<get_lowest_layer<F2>::type, F2>::value);
|
||||
BOOST_STATIC_ASSERT(std::is_same<get_lowest_layer<F3<F1>>::type, F1>::value);
|
||||
BOOST_STATIC_ASSERT(std::is_same<get_lowest_layer<F3<F2>>::type, F2>::value);
|
||||
BOOST_STATIC_ASSERT(std::is_same<get_lowest_layer<F4<F1>>::type, F1>::value);
|
||||
BOOST_STATIC_ASSERT(std::is_same<get_lowest_layer<F4<F2>>::type, F2>::value);
|
||||
BOOST_STATIC_ASSERT(std::is_same<get_lowest_layer<F4<F3<F1>>>::type, F1>::value);
|
||||
BOOST_STATIC_ASSERT(std::is_same<get_lowest_layer<F4<F3<F2>>>::type, F2>::value);
|
||||
BOOST_STATIC_ASSERT(std::is_same<get_lowest_layer<F1>, F1>::value);
|
||||
BOOST_STATIC_ASSERT(std::is_same<get_lowest_layer<F2>, F2>::value);
|
||||
BOOST_STATIC_ASSERT(std::is_same<get_lowest_layer<F3<F1>>, F1>::value);
|
||||
BOOST_STATIC_ASSERT(std::is_same<get_lowest_layer<F3<F2>>, F2>::value);
|
||||
BOOST_STATIC_ASSERT(std::is_same<get_lowest_layer<F4<F1>>, F1>::value);
|
||||
BOOST_STATIC_ASSERT(std::is_same<get_lowest_layer<F4<F2>>, F2>::value);
|
||||
BOOST_STATIC_ASSERT(std::is_same<get_lowest_layer<F4<F3<F1>>>, F1>::value);
|
||||
BOOST_STATIC_ASSERT(std::is_same<get_lowest_layer<F4<F3<F2>>>, F2>::value);
|
||||
|
||||
//
|
||||
// min_all, max_all
|
||||
|
Reference in New Issue
Block a user