mirror of
https://github.com/boostorg/beast.git
synced 2025-07-29 20:37:31 +02:00
is_completion_handler, type_traits.hpp are deprecated (API Change):
* is_completion_handler is deprecated * type_traits.hpp is a deprecated include These items will be removed in the next version * Include the new header file for the types needed: - stream_traits.hpp - file_base.hpp * Use std::is_invocable instead of is_completion_handler
This commit is contained in:
@ -6,16 +6,19 @@ Version 210:
|
||||
* Add stream_traits.hpp
|
||||
* Add executor_type trait
|
||||
* Fix hexadecimal string conversion table
|
||||
* is_completion_handler, type_traits.hpp are deprecated
|
||||
|
||||
API Changes:
|
||||
|
||||
* Stream traits are now in stream_traits.hpp
|
||||
* `is_file` is now in file_base.hpp
|
||||
* is_completion_handler is deprecated
|
||||
|
||||
Actions Required:
|
||||
|
||||
* Include stream_traits.hpp as needed
|
||||
* Include file_base.hpp as needed
|
||||
* Use std::is_invocable instead of is_completion_handler
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
@ -86,12 +86,6 @@ checks helps provide more concise errors during compilation:
|
||||
][
|
||||
Determine if a type meets the requirements of __AsyncWriteStream__.
|
||||
]]
|
||||
[[
|
||||
[link beast.ref.boost__beast__is_completion_handler `is_completion_handler`]
|
||||
][
|
||||
Determine if a type meets the requirements of __CompletionHandler__,
|
||||
and is callable with a specified signature.
|
||||
]]
|
||||
[[
|
||||
[link beast.ref.boost__beast__is_sync_read_stream `is_sync_read_stream`]
|
||||
][
|
||||
|
@ -82,7 +82,6 @@
|
||||
<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>
|
||||
<member><link linkend="beast.ref.boost__beast__is_async_stream">is_async_stream</link></member>
|
||||
<member><link linkend="beast.ref.boost__beast__is_completion_handler">is_completion_handler</link></member>
|
||||
<member><link linkend="beast.ref.boost__beast__is_file">is_file</link></member>
|
||||
<member><link linkend="beast.ref.boost__beast__is_sync_read_stream">is_sync_read_stream</link></member>
|
||||
<member><link linkend="beast.ref.boost__beast__is_sync_stream">is_sync_stream</link></member>
|
||||
|
@ -12,7 +12,6 @@
|
||||
|
||||
#include <boost/beast/core/detail/config.hpp>
|
||||
#include <boost/beast/core/error.hpp>
|
||||
#include <boost/beast/core/type_traits.hpp>
|
||||
#include <boost/beast/_experimental/core/detail/flat_stream.hpp>
|
||||
#include <boost/asio/async_result.hpp>
|
||||
#include <cstdlib>
|
||||
|
@ -12,8 +12,8 @@
|
||||
|
||||
#include <boost/beast/core/detail/config.hpp>
|
||||
#include <boost/beast/core/error.hpp>
|
||||
#include <boost/beast/core/type_traits.hpp>
|
||||
#include <boost/asio/async_result.hpp>
|
||||
#include <boost/asio/buffer.hpp>
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost {
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include <boost/beast/core/bind_handler.hpp>
|
||||
#include <boost/beast/core/flat_buffer.hpp>
|
||||
#include <boost/beast/core/string.hpp>
|
||||
#include <boost/beast/core/type_traits.hpp>
|
||||
#include <boost/beast/websocket/role.hpp>
|
||||
#include <boost/beast/_experimental/test/fail_count.hpp>
|
||||
#include <boost/asio/async_result.hpp>
|
||||
|
@ -45,6 +45,5 @@
|
||||
#include <boost/beast/core/string.hpp>
|
||||
#include <boost/beast/core/string_param.hpp>
|
||||
#include <boost/beast/core/timeout_stream.hpp>
|
||||
#include <boost/beast/core/type_traits.hpp>
|
||||
|
||||
#endif
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include <boost/beast/core/detail/config.hpp>
|
||||
#include <boost/beast/core/detail/timeout_stream_base.hpp>
|
||||
#include <boost/beast/core/error.hpp>
|
||||
#include <boost/beast/core/type_traits.hpp>
|
||||
#include <boost/asio/async_result.hpp>
|
||||
#include <boost/asio/basic_stream_socket.hpp>
|
||||
#include <boost/asio/connect.hpp>
|
||||
|
@ -11,7 +11,6 @@
|
||||
#define BOOST_BEAST_BIND_HANDLER_HPP
|
||||
|
||||
#include <boost/beast/core/detail/config.hpp>
|
||||
#include <boost/beast/core/type_traits.hpp>
|
||||
#include <boost/beast/core/detail/bind_handler.hpp>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
@ -65,12 +64,6 @@ detail::bind_wrapper<
|
||||
#endif
|
||||
bind_handler(Handler&& handler, Args&&... args)
|
||||
{
|
||||
#if 0
|
||||
// Can't do this because of placeholders
|
||||
static_assert(is_completion_handler<
|
||||
Handler, void(Args...)>::value,
|
||||
"Handler requirements not met");
|
||||
#endif
|
||||
return detail::bind_wrapper<
|
||||
typename std::decay<Handler>::type,
|
||||
typename std::decay<Args>::type...>(
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include <boost/beast/core/error.hpp>
|
||||
#include <boost/beast/core/multi_buffer.hpp>
|
||||
#include <boost/beast/core/stream_traits.hpp>
|
||||
#include <boost/beast/core/type_traits.hpp>
|
||||
#include <boost/asio/async_result.hpp>
|
||||
#include <boost/asio/buffer.hpp>
|
||||
#include <boost/asio/io_context.hpp>
|
||||
|
@ -133,10 +133,10 @@ struct is_contiguous_container<T, E, void_t<
|
||||
expected by the initiating function,
|
||||
*/
|
||||
#define BOOST_BEAST_HANDLER_INIT(type, sig) \
|
||||
static_assert(boost::beast::is_completion_handler< \
|
||||
static_assert(::boost::beast::detail::is_invocable< \
|
||||
BOOST_ASIO_HANDLER_TYPE(type, sig), sig>::value, \
|
||||
"CompletionHandler signature requirements not met"); \
|
||||
net::async_completion<type, sig> init{handler}
|
||||
::boost::beast::net::async_completion<type, sig> init{handler}
|
||||
|
||||
} // detail
|
||||
} // beast
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include <boost/beast/core/error.hpp>
|
||||
#include <boost/beast/core/read_size.hpp>
|
||||
#include <boost/beast/core/stream_traits.hpp>
|
||||
#include <boost/beast/core/type_traits.hpp>
|
||||
#include <boost/beast/core/detail/type_traits.hpp>
|
||||
#include <boost/asio/post.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
|
||||
@ -123,7 +123,7 @@ async_write_some(
|
||||
static_assert(net::is_const_buffer_sequence<
|
||||
ConstBufferSequence>::value,
|
||||
"ConstBufferSequence requirements not met");
|
||||
static_assert(is_completion_handler<WriteHandler,
|
||||
static_assert(detail::is_invocable<WriteHandler,
|
||||
void(error_code, std::size_t)>::value,
|
||||
"WriteHandler requirements not met");
|
||||
return next_layer_.async_write_some(buffers,
|
||||
|
@ -10,6 +10,7 @@
|
||||
#ifndef BOOST_BEAST_IMPL_READ_SIZE_HPP
|
||||
#define BOOST_BEAST_IMPL_READ_SIZE_HPP
|
||||
|
||||
#include <boost/asio/buffer.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <stdexcept>
|
||||
#include <type_traits>
|
||||
|
@ -11,7 +11,6 @@
|
||||
#define BOOST_BEAST_WRITE_OSTREAM_HPP
|
||||
|
||||
#include <boost/beast/core/detail/config.hpp>
|
||||
#include <boost/beast/core/type_traits.hpp>
|
||||
#include <boost/beast/core/detail/ostream.hpp>
|
||||
#include <type_traits>
|
||||
#include <streambuf>
|
||||
|
@ -11,7 +11,6 @@
|
||||
#define BOOST_BEAST_READ_SIZE_HELPER_HPP
|
||||
|
||||
#include <boost/beast/core/detail/config.hpp>
|
||||
#include <boost/beast/core/type_traits.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
@ -10,40 +10,32 @@
|
||||
#ifndef BOOST_BEAST_TYPE_TRAITS_HPP
|
||||
#define BOOST_BEAST_TYPE_TRAITS_HPP
|
||||
|
||||
#include <boost/beast/core/detail/config.hpp>
|
||||
#ifndef BOOST_BEAST_DOXYGEN
|
||||
|
||||
BOOST_PRAGMA_MESSAGE("<boost/beast/core/type_traits.hpp> is DEPRECATED and will be removed in a future release.")
|
||||
|
||||
#include <boost/beast/core/file_base.hpp>
|
||||
#include <boost/beast/core/stream_traits.hpp>
|
||||
#include <boost/beast/core/detail/is_invocable.hpp>
|
||||
#include <boost/beast/core/detail/type_traits.hpp>
|
||||
#include <boost/asio/buffer.hpp>
|
||||
#include <type_traits>
|
||||
#include <boost/config/pragma_message.hpp>
|
||||
#include <type_traits.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace beast {
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
// Handler concepts
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** Determine if `T` meets the requirements of @b CompletionHandler.
|
||||
|
||||
This trait checks whether a type meets the requirements for a completion
|
||||
handler, and is also callable with the specified signature.
|
||||
Metafunctions are used to perform compile time checking of template
|
||||
types. This type will be `std::true_type` if `T` meets the requirements,
|
||||
else the type will be `std::false_type`.
|
||||
|
||||
@par Example
|
||||
|
||||
Use with `static_assert`:
|
||||
|
||||
@code
|
||||
struct handler
|
||||
{
|
||||
void operator()(error_code&);
|
||||
};
|
||||
|
||||
static_assert(is_completion_handler<handler, void(error_code&)>::value,
|
||||
"Not a completion handler");
|
||||
@endcode
|
||||
@ -61,3 +53,5 @@ using is_completion_handler = std::integral_constant<bool,
|
||||
} // boost
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -12,7 +12,6 @@
|
||||
|
||||
#include <boost/beast/core/detail/config.hpp>
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/core/type_traits.hpp>
|
||||
#include <boost/beast/core/detail/buffer.hpp>
|
||||
#include <boost/beast/http/error.hpp>
|
||||
#include <boost/beast/http/message.hpp>
|
||||
|
@ -10,7 +10,6 @@
|
||||
#ifndef BOOST_BEAST_HTTP_DETAIL_CHUNK_ENCODE_HPP
|
||||
#define BOOST_BEAST_HTTP_DETAIL_CHUNK_ENCODE_HPP
|
||||
|
||||
#include <boost/beast/core/type_traits.hpp>
|
||||
#include <boost/beast/http/type_traits.hpp>
|
||||
#include <boost/asio/buffer.hpp>
|
||||
#include <algorithm>
|
||||
|
@ -12,7 +12,6 @@
|
||||
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/core/static_string.hpp>
|
||||
#include <boost/beast/core/type_traits.hpp>
|
||||
#include <boost/beast/core/detail/clamp.hpp>
|
||||
#include <boost/beast/core/detail/config.hpp>
|
||||
#include <boost/beast/http/error.hpp>
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include <boost/beast/core/async_op_base.hpp>
|
||||
#include <boost/beast/core/bind_handler.hpp>
|
||||
#include <boost/beast/core/buffers_range.hpp>
|
||||
#include <boost/beast/core/type_traits.hpp>
|
||||
#include <boost/beast/core/detail/clamp.hpp>
|
||||
#include <boost/beast/http/serializer.hpp>
|
||||
#include <boost/asio/async_result.hpp>
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include <boost/beast/core/buffers_range.hpp>
|
||||
#include <boost/beast/core/ostream.hpp>
|
||||
#include <boost/beast/core/stream_traits.hpp>
|
||||
#include <boost/beast/core/type_traits.hpp>
|
||||
#include <boost/asio/coroutine.hpp>
|
||||
#include <boost/asio/post.hpp>
|
||||
#include <boost/asio/write.hpp>
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include <boost/beast/core/buffers_prefix.hpp>
|
||||
#include <boost/beast/core/buffers_suffix.hpp>
|
||||
#include <boost/beast/core/string.hpp>
|
||||
#include <boost/beast/core/type_traits.hpp>
|
||||
#include <boost/beast/core/detail/variant.hpp>
|
||||
#include <boost/beast/http/message.hpp>
|
||||
#include <boost/beast/http/chunk_encode.hpp>
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include <boost/beast/core/detail/config.hpp>
|
||||
#include <boost/beast/core/error.hpp>
|
||||
#include <boost/beast/core/string.hpp>
|
||||
#include <boost/beast/core/type_traits.hpp>
|
||||
#include <boost/beast/http/detail/type_traits.hpp>
|
||||
#include <boost/asio/buffer.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include <boost/beast/core/async_op_base.hpp>
|
||||
#include <boost/beast/core/flat_static_buffer.hpp>
|
||||
#include <boost/beast/core/stream_traits.hpp>
|
||||
#include <boost/beast/core/type_traits.hpp>
|
||||
#include <boost/beast/core/detail/config.hpp>
|
||||
#include <boost/asio/coroutine.hpp>
|
||||
#include <boost/asio/post.hpp>
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include <boost/beast/http/write.hpp>
|
||||
#include <boost/beast/core/async_op_base.hpp>
|
||||
#include <boost/beast/core/stream_traits.hpp>
|
||||
#include <boost/beast/core/type_traits.hpp>
|
||||
#include <boost/asio/coroutine.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include <boost/beast/core/async_op_base.hpp>
|
||||
#include <boost/beast/core/bind_handler.hpp>
|
||||
#include <boost/beast/core/stream_traits.hpp>
|
||||
#include <boost/beast/core/type_traits.hpp>
|
||||
#include <boost/beast/websocket/detail/frame.hpp>
|
||||
#include <boost/asio/coroutine.hpp>
|
||||
#include <boost/asio/post.hpp>
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include <boost/beast/core/buffers_suffix.hpp>
|
||||
#include <boost/beast/core/flat_static_buffer.hpp>
|
||||
#include <boost/beast/core/stream_traits.hpp>
|
||||
#include <boost/beast/core/type_traits.hpp>
|
||||
#include <boost/beast/core/detail/buffer.hpp>
|
||||
#include <boost/beast/core/detail/clamp.hpp>
|
||||
#include <boost/beast/core/detail/config.hpp>
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include <boost/beast/core/buffers_prefix.hpp>
|
||||
#include <boost/beast/core/buffers_suffix.hpp>
|
||||
#include <boost/beast/core/flat_static_buffer.hpp>
|
||||
#include <boost/beast/core/type_traits.hpp>
|
||||
#include <boost/beast/core/detail/clamp.hpp>
|
||||
#include <boost/beast/core/detail/type_traits.hpp>
|
||||
#include <boost/asio/bind_executor.hpp>
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include <boost/beast/core/async_op_base.hpp>
|
||||
#include <boost/beast/core/bind_handler.hpp>
|
||||
#include <boost/beast/core/stream_traits.hpp>
|
||||
#include <boost/beast/core/type_traits.hpp>
|
||||
#include <boost/beast/core/detail/type_traits.hpp>
|
||||
#include <boost/asio/coroutine.hpp>
|
||||
#include <boost/asio/post.hpp>
|
||||
#include <memory>
|
||||
@ -168,7 +168,7 @@ async_teardown(
|
||||
net::ip::tcp::socket& socket,
|
||||
TeardownHandler&& handler)
|
||||
{
|
||||
static_assert(beast::is_completion_handler<
|
||||
static_assert(beast::detail::is_invocable<
|
||||
TeardownHandler, void(error_code)>::value,
|
||||
"TeardownHandler requirements not met");
|
||||
detail::teardown_tcp_op<typename std::decay<
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include <boost/beast/core/buffers_suffix.hpp>
|
||||
#include <boost/beast/core/flat_static_buffer.hpp>
|
||||
#include <boost/beast/core/stream_traits.hpp>
|
||||
#include <boost/beast/core/type_traits.hpp>
|
||||
#include <boost/beast/core/detail/clamp.hpp>
|
||||
#include <boost/beast/core/detail/config.hpp>
|
||||
#include <boost/beast/websocket/detail/frame.hpp>
|
||||
|
@ -65,7 +65,6 @@ add_executable (tests-beast-core
|
||||
string.cpp
|
||||
string_param.cpp
|
||||
timeout_stream.cpp
|
||||
type_traits.cpp
|
||||
)
|
||||
|
||||
set_property(TARGET tests-beast-core PROPERTY FOLDER "tests")
|
||||
|
@ -53,7 +53,6 @@ local SOURCES =
|
||||
string.cpp
|
||||
string_param.cpp
|
||||
timeout_stream.cpp
|
||||
type_traits.cpp
|
||||
;
|
||||
|
||||
local RUN_TESTS ;
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include <boost/beast/core/buffer_traits.hpp>
|
||||
#include <boost/beast/core/buffers_to_string.hpp>
|
||||
#include <boost/beast/core/string.hpp>
|
||||
#include <boost/beast/core/type_traits.hpp>
|
||||
#include <boost/beast/core/detail/type_traits.hpp>
|
||||
#include <boost/asio/buffer.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
|
@ -14,7 +14,6 @@
|
||||
|
||||
#include <boost/beast/core/buffer_size.hpp>
|
||||
#include <boost/beast/core/buffers_to_string.hpp>
|
||||
#include <boost/beast/core/type_traits.hpp>
|
||||
#include <boost/beast/_experimental/unit_test/suite.hpp>
|
||||
#include <string>
|
||||
|
||||
|
@ -14,7 +14,6 @@
|
||||
|
||||
#include "file_test.hpp"
|
||||
|
||||
#include <boost/beast/core/type_traits.hpp>
|
||||
#include <boost/beast/_experimental/unit_test/suite.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
@ -12,7 +12,6 @@
|
||||
|
||||
#include "file_test.hpp"
|
||||
|
||||
#include <boost/beast/core/type_traits.hpp>
|
||||
#include <boost/beast/_experimental/unit_test/suite.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
@ -14,7 +14,6 @@
|
||||
|
||||
#include "file_test.hpp"
|
||||
|
||||
#include <boost/beast/core/type_traits.hpp>
|
||||
#include <boost/beast/_experimental/unit_test/suite.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include <boost/beast/core/ostream.hpp>
|
||||
#include <boost/beast/core/read_size.hpp>
|
||||
#include <boost/beast/core/string.hpp>
|
||||
#include <boost/beast/core/type_traits.hpp>
|
||||
#include <boost/beast/test/test_allocator.hpp>
|
||||
#include <boost/beast/_experimental/unit_test/suite.hpp>
|
||||
#include <boost/asio/buffer.hpp>
|
||||
|
@ -12,7 +12,6 @@
|
||||
|
||||
#include <boost/beast/_experimental/unit_test/suite.hpp>
|
||||
#include <boost/beast/core/error.hpp>
|
||||
#include <boost/beast/core/type_traits.hpp>
|
||||
#include <boost/asio/io_context.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
@ -1,39 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2016-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)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/beast
|
||||
//
|
||||
|
||||
// Test that header file is self-contained.
|
||||
#include <boost/beast/core/type_traits.hpp>
|
||||
|
||||
#include <boost/beast/_experimental/test/stream.hpp>
|
||||
#include <boost/asio/ip/tcp.hpp>
|
||||
#include <boost/asio/streambuf.hpp>
|
||||
#include <boost/asio/detail/consuming_buffers.hpp>
|
||||
#include <memory>
|
||||
|
||||
namespace boost {
|
||||
namespace beast {
|
||||
|
||||
//
|
||||
// handler concepts
|
||||
//
|
||||
|
||||
namespace {
|
||||
|
||||
struct H
|
||||
{
|
||||
void operator()(int){}
|
||||
};
|
||||
|
||||
} // anonymous
|
||||
|
||||
BOOST_STATIC_ASSERT(is_completion_handler<H, void(int)>::value);
|
||||
BOOST_STATIC_ASSERT(! is_completion_handler<H, void(void)>::value);
|
||||
|
||||
} // beast
|
||||
} // boost
|
@ -16,7 +16,6 @@
|
||||
#include <boost/beast/http/rfc7230.hpp>
|
||||
#include <boost/beast/core/buffers_range.hpp>
|
||||
#include <boost/beast/core/error.hpp>
|
||||
#include <boost/beast/core/type_traits.hpp>
|
||||
#include <boost/asio/buffer.hpp>
|
||||
#include <boost/system/error_code.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
|
Reference in New Issue
Block a user