diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f793ab2..8f2d8e62 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ Version 230: * Don't use dynamic_buffer_ref +* Remove dynamic_buffer_ref -------------------------------------------------------------------------------- diff --git a/doc/qbk/03_core/5_buffers.qbk b/doc/qbk/03_core/5_buffers.qbk index 5f18b0cc..7043980b 100644 --- a/doc/qbk/03_core/5_buffers.qbk +++ b/doc/qbk/03_core/5_buffers.qbk @@ -133,15 +133,6 @@ set of additional implementations of the dynamic buffer concept: The basic container is an [@https://en.cppreference.com/w/cpp/named_req/AllocatorAwareContainer [*AllocatorAwareContainer]]. ]] -[[ - [link beast.ref.boost__beast__dynamic_buffer_ref `dynamic_buffer_ref`] - [link beast.ref.boost__beast__dynamic_buffer_ref_wrapper `dynamic_buffer_ref_wrapper`] -][ - This function returns a wrapper containing a reference to the passed - dynamic buffer, permitting a Beast dynamic buffer type (which acts - like a true container type) to be used with Networking algorithms - which want to take ownership of the dynamic buffer in their interface. -]] [[ [link beast.ref.boost__beast__flat_static_buffer `flat_static_buffer`] [link beast.ref.boost__beast__flat_static_buffer_base `flat_static_buffer_base`] diff --git a/doc/qbk/03_core/7_composed.qbk b/doc/qbk/03_core/7_composed.qbk index 83e9aa12..3f57e8fb 100644 --- a/doc/qbk/03_core/7_composed.qbk +++ b/doc/qbk/03_core/7_composed.qbk @@ -89,18 +89,6 @@ composed operations: handler, whose associated allocator and associated executor will will be the same as those of the original handler. ]] -[[ - [link beast.ref.boost__beast__handler_ptr `handler_ptr`] -][ - This is a smart pointer container used to manage the internal state of a - composed operation. It is useful when the state is non trivial. For example - when the state has non-movable or contains expensive to move types. The - container takes ownership of the final completion handler, and provides - boilerplate to invoke the final handler in a way that also deletes the - internal state. The internal state is allocated using the final completion - handler's associated allocator, benefiting from all handler memory - management optimizations transparently. -]] [[ [link beast.ref.boost__beast__saved_handler `saved_handler`] ][ diff --git a/doc/qbk/quickref.xml b/doc/qbk/quickref.xml index 07b1bb0f..c781fca9 100644 --- a/doc/qbk/quickref.xml +++ b/doc/qbk/quickref.xml @@ -132,7 +132,6 @@ buffers_cat_view buffers_prefix_view buffers_suffix - dynamic_buffer_ref_wrapper  flat_buffer flat_static_buffer flat_static_buffer_base @@ -150,7 +149,6 @@ buffers_range  buffers_range_ref  buffers_to_string - dynamic_buffer_ref  make_printable  ostream read_size diff --git a/doc/qbk/release_notes.qbk b/doc/qbk/release_notes.qbk index 9b606ea8..b67874ff 100644 --- a/doc/qbk/release_notes.qbk +++ b/doc/qbk/release_notes.qbk @@ -160,7 +160,6 @@ * New: * `saved_handler` * `buffers_range_ref` - * `dynamic_buffer_ref` * `executor_type` * `get_lowest_layer`, `lowest_layer_type` diff --git a/include/boost/beast/core.hpp b/include/boost/beast/core.hpp index edd84a40..905476d3 100644 --- a/include/boost/beast/core.hpp +++ b/include/boost/beast/core.hpp @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include diff --git a/include/boost/beast/core/dynamic_buffer_ref.hpp b/include/boost/beast/core/dynamic_buffer_ref.hpp deleted file mode 100644 index 8ee42fed..00000000 --- a/include/boost/beast/core/dynamic_buffer_ref.hpp +++ /dev/null @@ -1,143 +0,0 @@ -// -// Copyright (c) 2016-2019 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) -// -// Official repository: https://github.com/boostorg/beast -// - -#ifndef BOOST_BEAST_CORE_DYNAMIC_BUFFER_REF_HPP -#define BOOST_BEAST_CORE_DYNAMIC_BUFFER_REF_HPP - -#include -#include -#include -#include - -namespace boost { -namespace beast { - -/** A lightweight reference to a dynamic buffer. - - Objects of this type meet the requirements of DynamicBuffer. - This is the wrapper returned by the function @ref dynamic_buffer_ref. - - @see dynamic_buffer_ref -*/ -template -class dynamic_buffer_ref_wrapper -#if ! BOOST_BEAST_DOXYGEN -{ - static_assert(net::is_dynamic_buffer::value, - "DynamicBuffer type requirements not met"); - - DynamicBuffer& b_; - -public: - using const_buffers_type = typename - DynamicBuffer::const_buffers_type; - - using mutable_buffers_type = typename - DynamicBuffer::mutable_buffers_type; - - dynamic_buffer_ref_wrapper( - dynamic_buffer_ref_wrapper&&) = default; - - dynamic_buffer_ref_wrapper( - dynamic_buffer_ref_wrapper const&) = default; - - explicit - dynamic_buffer_ref_wrapper( - DynamicBuffer& b) noexcept - : b_(b) - { - } - - std::size_t - size() const noexcept - { - return b_.size(); - } - - std::size_t - max_size() const noexcept - { - return b_.max_size(); - } - - std::size_t - capacity() const noexcept - { - return b_.capacity(); - } - - const_buffers_type - data() const noexcept - { - return b_.data(); - } - - mutable_buffers_type - prepare(std::size_t n) - { - return b_.prepare(n); - } - - void - commit(std::size_t n) - { - b_.commit(n); - } - - void - consume(std::size_t n) - { - b_.consume(n); - } -} -#endif -; - -/** Return a non-owning reference to a dynamic buffer. - - This function returns a wrapper which holds a reference to the - passed dynamic buffer. The wrapper meets the requirements of - DynamicBuffer, allowing its use in Networking algorithms - which want to take ownership of the dynamic buffer. Since Beast - dynamic buffers are true storage types, they cannot be used directly - with functions that take ownership of the dynamic buffer. - - @par Example - This function reads a line of text from a stream into a - @ref beast::basic_flat_buffer, using the net function `async_read_until`. - @code - template - std::size_t read_line (SyncReadStream& stream, flat_buffer& buffer) - { - return net::read_until(stream, dynamic_buffer_ref(buffer), "\r\n"); - } - @endcode - - @param buffer The dynamic buffer to wrap. Ownership of the buffer is - not transferred, the caller is still responsible for managing the - lifetime of the original object. - - @return A wrapper meeting the requirements of DynamicBuffer - which references the original dynamic buffer. - - @see dynamic_buffer_ref_wrapper -*/ -template -dynamic_buffer_ref_wrapper -dynamic_buffer_ref(DynamicBuffer& buffer) noexcept -{ - static_assert(net::is_dynamic_buffer::value, - "DynamicBuffer type requirements not met"); - return dynamic_buffer_ref_wrapper(buffer); -} - -} // beast -} // boost - -#endif diff --git a/test/beast/core/CMakeLists.txt b/test/beast/core/CMakeLists.txt index f6aba25d..c81d48c9 100644 --- a/test/beast/core/CMakeLists.txt +++ b/test/beast/core/CMakeLists.txt @@ -44,7 +44,6 @@ add_executable (tests-beast-core buffers_suffix.cpp buffers_to_string.cpp detect_ssl.cpp - dynamic_buffer_ref.cpp error.cpp file.cpp file_base.cpp diff --git a/test/beast/core/Jamfile b/test/beast/core/Jamfile index cb5e295b..14e0096e 100644 --- a/test/beast/core/Jamfile +++ b/test/beast/core/Jamfile @@ -32,7 +32,6 @@ local SOURCES = buffers_suffix.cpp buffers_to_string.cpp detect_ssl.cpp - dynamic_buffer_ref.cpp error.cpp file.cpp file_base.cpp diff --git a/test/beast/core/dynamic_buffer_ref.cpp b/test/beast/core/dynamic_buffer_ref.cpp deleted file mode 100644 index e25c6cea..00000000 --- a/test/beast/core/dynamic_buffer_ref.cpp +++ /dev/null @@ -1,73 +0,0 @@ -// -// Copyright (c) 2016-2019 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) -// -// Official repository: https://github.com/boostorg/beast -// - -// Test that header file is self-contained. -#include - -#include -#include -#include -#include - -namespace boost { -namespace beast { - -namespace { - -template -std::size_t read_line (SyncReadStream& stream, flat_buffer& buffer) -{ - return net::read_until(stream, dynamic_buffer_ref(buffer), "\r\n"); -} - -} // (anon) - -class dynamic_buffer_ref_test : public beast::unit_test::suite -{ -public: - void - testJavadocs() - { - BEAST_EXPECT(static_cast< - std::size_t(*)(test::stream&, flat_buffer&)>( - &read_line)); - } - - void - testBuffer() - { - flat_buffer b; - b.max_size(1000); - auto db = dynamic_buffer_ref(b); - BEAST_EXPECT(db.max_size() == 1000); - BEAST_EXPECT(db.size() == 0); - BEAST_EXPECT(db.capacity() == 0); - db.prepare(512); - BEAST_EXPECT(db.size() == 0); - BEAST_EXPECT(db.capacity() == 512); - db.commit(12); - BEAST_EXPECT(db.size() == 12); - BEAST_EXPECT(db.capacity() == 512); - BEAST_EXPECT(buffer_bytes(db.data()) == 12); - db.consume(12); - BEAST_EXPECT(db.size() == 0); - BEAST_EXPECT(db.capacity() == 512); - } - - void run() override - { - testJavadocs(); - testBuffer(); - } -}; - -BEAST_DEFINE_TESTSUITE(beast,core,dynamic_buffer_ref); - -} // beast -} // boost