lowest_layer is removed (API Change):

The nested function lowest_layer and nested type lowest_layer_type
are removed from all stream layers.

Actions Required:

* Remove lowest_layer and lowest_layer_type from user-defined streams.
* Use the get_lowest_layer free function and the lowest_layer_type trait
  as needed.
This commit is contained in:
Vinnie Falco
2019-01-22 04:49:22 -08:00
parent 29f838b9d9
commit 60c96104ec
13 changed files with 11 additions and 279 deletions

View File

@@ -2,6 +2,16 @@ Version 207
* Send from the strand
API Changes:
* lowest_layer is removed
Actions Required:
* Remove lowest_layer and lowest_layer_type from user-defined streams.
* Use the get_lowest_layer free function and the lowest_layer_type trait
as needed.
--------------------------------------------------------------------------------
Version 206

View File

@@ -60,11 +60,6 @@ checks helps provide more concise errors during compilation:
[table Stream Type Checks
[[Name][Description]]
[[
[link beast.ref.boost__beast__get_lowest_layer `get_lowest_layer`]
][
Returns `T::lowest_layer_type` if it exists, else returns `T`.
]]
[[
[link beast.ref.boost__beast__has_get_executor `has_get_executor`]
][

View File

@@ -248,7 +248,6 @@
<simplelist type="vert" columns="1">
<member><link linkend="beast.ref.boost__beast__buffers_type">buffers_type</link></member>
<member><link linkend="beast.ref.boost__beast__buffers_iterator_type">buffers_iterator_type</link></member>
<member><link linkend="beast.ref.boost__beast__get_lowest_layer">get_lowest_layer</link></member>
<member><link linkend="beast.ref.boost__beast__has_get_executor">has_get_executor</link></member>
<member><link linkend="beast.ref.boost__beast__is_async_read_stream">is_async_read_stream</link></member>
<member><link linkend="beast.ref.boost__beast__is_async_write_stream">is_async_write_stream</link></member>

View File

@@ -102,9 +102,6 @@ public:
using next_layer_type =
typename std::remove_reference<NextLayer>::type;
/// The type of the lowest layer.
using lowest_layer_type = boost::beast::get_lowest_layer<next_layer_type>;
/// The type of the executor associated with the object.
using executor_type = typename next_layer_type::executor_type;
@@ -171,34 +168,6 @@ public:
return stream_;
}
/** Get a reference to the lowest layer
This function returns a reference to the lowest layer
in a stack of stream layers.
@return A reference to the lowest layer in the stack of
stream layers.
*/
lowest_layer_type&
lowest_layer() noexcept
{
return stream_.lowest_layer();
}
/** Get a reference to the lowest layer
This function returns a reference to the lowest layer
in a stack of stream layers.
@return A reference to the lowest layer in the stack of
stream layers. Ownership is not transferred to the caller.
*/
lowest_layer_type const&
lowest_layer() const noexcept
{
return stream_.lowest_layer();
}
//--------------------------------------------------------------------------
/** Read some data from the stream.

View File

@@ -84,9 +84,6 @@ public:
/// The type of the next layer.
using next_layer_type = typename ssl_stream_type::next_layer_type;
/// The type of the lowest layer.
using lowest_layer_type = typename ssl_stream_type::lowest_layer_type;
/// The type of the executor associated with the object.
using executor_type = typename stream_type::executor_type;
@@ -185,34 +182,6 @@ public:
return p_->next_layer().next_layer();
}
/** Get a reference to the lowest layer.
This function returns a reference to the lowest layer in a stack of stream
layers.
@return A reference to the lowest layer in the stack of stream layers.
Ownership is not transferred to the caller.
*/
lowest_layer_type&
lowest_layer() noexcept
{
return p_->lowest_layer();
}
/** Get a reference to the lowest layer.
This function returns a reference to the lowest layer in a stack of stream
layers.
@return A reference to the lowest layer in the stack of stream layers.
Ownership is not transferred to the caller.
*/
lowest_layer_type const&
lowest_layer() const noexcept
{
return p_->lowest_layer();
}
/** Set the peer verification mode.
This function may be used to configure the peer verification mode used by

View File

@@ -87,10 +87,6 @@ public:
using next_layer_type =
typename std::remove_reference<NextLayer>::type;
/// The type of the lowest layer.
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;
@@ -157,34 +153,6 @@ public:
return stream_;
}
/** Get a reference to the lowest layer
This function returns a reference to the lowest layer
in a stack of stream layers.
@return A reference to the lowest layer in the stack of
stream layers.
*/
lowest_layer_type&
lowest_layer()
{
return stream_.lowest_layer();
}
/** Get a reference to the lowest layer
This function returns a reference to the lowest layer
in a stack of stream layers.
@return A reference to the lowest layer in the stack of
stream layers. Ownership is not transferred to the caller.
*/
lowest_layer_type const&
lowest_layer() const
{
return stream_.lowest_layer();
}
//--------------------------------------------------------------------------
/** Read some data from the stream.

View File

@@ -165,9 +165,6 @@ class stream
public:
using buffer_type = flat_buffer;
/// The type of the lowest layer.
using lowest_layer_type = stream;
/** Destructor
If an asynchronous read operation is pending, it will
@@ -278,34 +275,6 @@ public:
return in_->ioc.get_executor();
};
/** Get a reference to the lowest layer
This function returns a reference to the lowest layer
in a stack of stream layers.
@return A reference to the lowest layer in the stack of
stream layers.
*/
lowest_layer_type&
lowest_layer() noexcept
{
return *this;
}
/** Get a reference to the lowest layer
This function returns a reference to the lowest layer
in a stack of stream layers.
@return A reference to the lowest layer in the stack of
stream layers. Ownership is not transferred to the caller.
*/
lowest_layer_type const&
lowest_layer() const noexcept
{
return *this;
}
/// Set the maximum number of bytes returned by read_some
void
read_size(std::size_t n) noexcept

View File

@@ -111,9 +111,6 @@ public:
using next_layer_type =
typename std::remove_reference<Stream>::type;
/// The type of the lowest layer.
using lowest_layer_type = get_lowest_layer<next_layer_type>;
/** Move constructor.
@note The behavior of move assignment on or from streams
@@ -150,20 +147,6 @@ public:
return next_layer_;
}
/// Get a reference to the lowest layer.
lowest_layer_type&
lowest_layer() noexcept
{
return next_layer_.lowest_layer();
}
/// Get a const reference to the lowest layer.
lowest_layer_type const&
lowest_layer() const noexcept
{
return next_layer_.lowest_layer();
}
using executor_type =
detail::get_executor_type<next_layer_type>;

View File

@@ -161,21 +161,6 @@ struct is_contiguous_container<T, E, void_t<
//------------------------------------------------------------------------------
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
//

View File

@@ -121,41 +121,6 @@ struct has_get_executor<T, beast::detail::void_t<decltype(
std::declval<T&>().get_executor())>> : std::true_type {};
#endif
/** Alias for `T::lowest_layer_type` if it exists, else `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
Declaring a wrapper:
@code
template<class Stream>
struct stream_wrapper
{
using next_layer_type = typename std::remove_reference<Stream>::type;
using lowest_layer_type = get_lowest_layer<stream_type>;
};
@endcode
Defining a metafunction:
@code
/// 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, get_lowest_layer<T>>::value> {};
@endcode
*/
#if BOOST_BEAST_DOXYGEN
template<class T>
struct get_lowest_layer;
#else
template<class T>
using get_lowest_layer = typename detail::get_lowest_layer_helper<T>::type;
#endif
/** Determine if `T` meets the requirements of @b AsyncReadStream.
Metafunctions are used to perform compile time checking of template

View File

@@ -79,24 +79,6 @@ next_layer() const noexcept ->
return impl_->stream;
}
template<class NextLayer, bool deflateSupported>
auto
stream<NextLayer, deflateSupported>::
lowest_layer() noexcept ->
lowest_layer_type&
{
return impl_->stream.lowest_layer();
}
template<class NextLayer, bool deflateSupported>
auto
stream<NextLayer, deflateSupported>::
lowest_layer() const noexcept ->
lowest_layer_type const&
{
return impl_->stream.lowest_layer();
}
template<class NextLayer, bool deflateSupported>
bool
stream<NextLayer, deflateSupported>::

View File

@@ -161,9 +161,6 @@ public:
using next_layer_type =
typename std::remove_reference<NextLayer>::type;
/// The type of the lowest layer.
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;
@@ -245,30 +242,6 @@ public:
next_layer_type const&
next_layer() const noexcept;
/** Get a reference to the lowest layer
This function returns a reference to the lowest layer
in a stack of stream layers.
@return A reference to the lowest layer in the stack of
stream layers.
*/
// DEPRECATED
lowest_layer_type&
lowest_layer() noexcept;
/** Get a reference to the lowest layer
This function returns a reference to the lowest layer
in a stack of stream layers.
@return A reference to the lowest layer in the stack of
stream layers. Ownership is not transferred to the caller.
*/
// DEPRECATED
lowest_layer_type const&
lowest_layer() const noexcept;
//--------------------------------------------------------------------------
//
// Observers

View File

@@ -58,41 +58,6 @@ BOOST_STATIC_ASSERT(! is_invocable<is_invocable_udt3 const, int(int)>::value);
BOOST_STATIC_ASSERT(is_invocable<is_invocable_udt4, void(std::unique_ptr<int>)>::value);
#endif
//
// get_lowest_layer
//
struct F1 {};
struct F2 {};
template<class F>
struct F3
{
using next_layer_type =
typename std::remove_reference<F>::type;
using lowest_layer_type = get_lowest_layer<next_layer_type>;
};
template<class F>
struct F4
{
using next_layer_type =
typename std::remove_reference<F>::type;
using lowest_layer_type =
get_lowest_layer<next_layer_type>;
};
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);
} // (anonymous)
} // detail