From 60c96104ec111d879c2dbe3b24a91b73d3c8c2c5 Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Tue, 22 Jan 2019 04:49:22 -0800 Subject: [PATCH] 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. --- CHANGELOG.md | 10 ++++++ doc/qbk/03_core/2_streams.qbk | 5 --- doc/qbk/quickref.xml | 1 - .../beast/_experimental/core/flat_stream.hpp | 31 ---------------- .../beast/_experimental/core/ssl_stream.hpp | 33 +---------------- .../beast/_experimental/http/icy_stream.hpp | 32 ----------------- .../boost/beast/_experimental/test/stream.hpp | 31 ---------------- .../boost/beast/core/buffered_read_stream.hpp | 17 --------- .../boost/beast/core/detail/type_traits.hpp | 15 -------- include/boost/beast/core/type_traits.hpp | 35 ------------------- include/boost/beast/websocket/impl/stream.hpp | 18 ---------- include/boost/beast/websocket/stream.hpp | 27 -------------- test/beast/core/type_traits.cpp | 35 ------------------- 13 files changed, 11 insertions(+), 279 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 39a3355c..41005f7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/doc/qbk/03_core/2_streams.qbk b/doc/qbk/03_core/2_streams.qbk index d9d20c01..2f9e3a20 100644 --- a/doc/qbk/03_core/2_streams.qbk +++ b/doc/qbk/03_core/2_streams.qbk @@ -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`] ][ diff --git a/doc/qbk/quickref.xml b/doc/qbk/quickref.xml index e6f110ae..27de1ccb 100644 --- a/doc/qbk/quickref.xml +++ b/doc/qbk/quickref.xml @@ -248,7 +248,6 @@ buffers_type buffers_iterator_type - get_lowest_layer has_get_executor is_async_read_stream is_async_write_stream diff --git a/include/boost/beast/_experimental/core/flat_stream.hpp b/include/boost/beast/_experimental/core/flat_stream.hpp index 58fd518f..7727fe8f 100644 --- a/include/boost/beast/_experimental/core/flat_stream.hpp +++ b/include/boost/beast/_experimental/core/flat_stream.hpp @@ -102,9 +102,6 @@ public: using next_layer_type = typename std::remove_reference::type; - /// The type of the lowest layer. - using lowest_layer_type = boost::beast::get_lowest_layer; - /// 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. diff --git a/include/boost/beast/_experimental/core/ssl_stream.hpp b/include/boost/beast/_experimental/core/ssl_stream.hpp index 36c3640b..9cbc5af3 100644 --- a/include/boost/beast/_experimental/core/ssl_stream.hpp +++ b/include/boost/beast/_experimental/core/ssl_stream.hpp @@ -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,35 +182,7 @@ 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. + /** Set the peer verification mode. This function may be used to configure the peer verification mode used by the stream. The new mode will override the mode inherited from the context. diff --git a/include/boost/beast/_experimental/http/icy_stream.hpp b/include/boost/beast/_experimental/http/icy_stream.hpp index a992daf1..37a5df19 100644 --- a/include/boost/beast/_experimental/http/icy_stream.hpp +++ b/include/boost/beast/_experimental/http/icy_stream.hpp @@ -87,10 +87,6 @@ public: using next_layer_type = typename std::remove_reference::type; - /// The type of the lowest layer. - using lowest_layer_type = - get_lowest_layer; - /// 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. diff --git a/include/boost/beast/_experimental/test/stream.hpp b/include/boost/beast/_experimental/test/stream.hpp index 63159e95..c1c0f519 100644 --- a/include/boost/beast/_experimental/test/stream.hpp +++ b/include/boost/beast/_experimental/test/stream.hpp @@ -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 diff --git a/include/boost/beast/core/buffered_read_stream.hpp b/include/boost/beast/core/buffered_read_stream.hpp index c66237ec..69a757f6 100644 --- a/include/boost/beast/core/buffered_read_stream.hpp +++ b/include/boost/beast/core/buffered_read_stream.hpp @@ -111,9 +111,6 @@ public: using next_layer_type = typename std::remove_reference::type; - /// The type of the lowest layer. - using lowest_layer_type = get_lowest_layer; - /** 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; diff --git a/include/boost/beast/core/detail/type_traits.hpp b/include/boost/beast/core/detail/type_traits.hpp index dce213d0..a6d8f305 100644 --- a/include/boost/beast/core/detail/type_traits.hpp +++ b/include/boost/beast/core/detail/type_traits.hpp @@ -161,21 +161,6 @@ struct is_contiguous_container -struct get_lowest_layer_helper -{ - using type = T; -}; - -template -struct get_lowest_layer_helper> -{ - using type = typename T::lowest_layer_type; -}; - -//------------------------------------------------------------------------------ - // // buffer concepts // diff --git a/include/boost/beast/core/type_traits.hpp b/include/boost/beast/core/type_traits.hpp index befc17f2..91b50c73 100644 --- a/include/boost/beast/core/type_traits.hpp +++ b/include/boost/beast/core/type_traits.hpp @@ -121,41 +121,6 @@ struct has_get_executor().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 - struct stream_wrapper - { - using next_layer_type = typename std::remove_reference::type; - using lowest_layer_type = get_lowest_layer; - }; - @endcode - - Defining a metafunction: - - @code - /// Alias for `std::true_type` if `T` wraps another stream - template - using is_stream_wrapper : std::integral_constant>::value> {}; - @endcode -*/ -#if BOOST_BEAST_DOXYGEN -template -struct get_lowest_layer; -#else -template -using get_lowest_layer = typename detail::get_lowest_layer_helper::type; -#endif - /** Determine if `T` meets the requirements of @b AsyncReadStream. Metafunctions are used to perform compile time checking of template diff --git a/include/boost/beast/websocket/impl/stream.hpp b/include/boost/beast/websocket/impl/stream.hpp index 430d8921..dbd5e1af 100644 --- a/include/boost/beast/websocket/impl/stream.hpp +++ b/include/boost/beast/websocket/impl/stream.hpp @@ -79,24 +79,6 @@ next_layer() const noexcept -> return impl_->stream; } -template -auto -stream:: -lowest_layer() noexcept -> - lowest_layer_type& -{ - return impl_->stream.lowest_layer(); -} - -template -auto -stream:: -lowest_layer() const noexcept -> - lowest_layer_type const& -{ - return impl_->stream.lowest_layer(); -} - template bool stream:: diff --git a/include/boost/beast/websocket/stream.hpp b/include/boost/beast/websocket/stream.hpp index 17247ef3..7438d214 100644 --- a/include/boost/beast/websocket/stream.hpp +++ b/include/boost/beast/websocket/stream.hpp @@ -161,9 +161,6 @@ public: using next_layer_type = typename std::remove_reference::type; - /// The type of the lowest layer. - using lowest_layer_type = get_lowest_layer; - /// 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 diff --git a/test/beast/core/type_traits.cpp b/test/beast/core/type_traits.cpp index 9ca2c0e1..1821edf3 100644 --- a/test/beast/core/type_traits.cpp +++ b/test/beast/core/type_traits.cpp @@ -58,41 +58,6 @@ BOOST_STATIC_ASSERT(! is_invocable::value); BOOST_STATIC_ASSERT(is_invocable)>::value); #endif -// -// get_lowest_layer -// - -struct F1 {}; -struct F2 {}; - -template -struct F3 -{ - using next_layer_type = - typename std::remove_reference::type; - - using lowest_layer_type = get_lowest_layer; -}; - -template -struct F4 -{ - using next_layer_type = - typename std::remove_reference::type; - - using lowest_layer_type = - get_lowest_layer; -}; - -BOOST_STATIC_ASSERT(std::is_same, F1>::value); -BOOST_STATIC_ASSERT(std::is_same, F2>::value); -BOOST_STATIC_ASSERT(std::is_same>, F1>::value); -BOOST_STATIC_ASSERT(std::is_same>, F2>::value); -BOOST_STATIC_ASSERT(std::is_same>, F1>::value); -BOOST_STATIC_ASSERT(std::is_same>, F2>::value); -BOOST_STATIC_ASSERT(std::is_same>>, F1>::value); -BOOST_STATIC_ASSERT(std::is_same>>, F2>::value); - } // (anonymous) } // detail