diff --git a/include/boost/beast/_experimental/core/detail/saved_handler.hpp b/include/boost/beast/_experimental/core/detail/saved_handler.hpp deleted file mode 100644 index 6990cb0e..00000000 --- a/include/boost/beast/_experimental/core/detail/saved_handler.hpp +++ /dev/null @@ -1,110 +0,0 @@ -// -// Copyright (c) 2018 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_DETAIL_SAVED_HANDLER_HPP -#define BOOST_BEAST_CORE_DETAIL_SAVED_HANDLER_HPP - -#include -#include -#include -#include - -namespace boost { -namespace beast { -namespace detail { - -class saved_handler -{ - struct base - { - virtual ~base() = default; - virtual void operator()() = 0; - }; - - template - struct impl : base - { - Handler h_; - - template - explicit - impl(Deduced&& h) - : h_(std::forward(h)) - { - } - - void operator()() override - { - net::dispatch(std::move(h_)); - } - }; - - std::unique_ptr p_; - -public: - saved_handler() = default; - - template - void - emplace(Handler&& h) - { - p_.reset(new impl::type>( - std::forward(h))); - } - - template< - class Handler, class T0, class... TN> - void - emplace(Handler&& h, T0&& t0, TN&&... tn) - { - using type = decltype( - beast::bind_front_handler( - std::forward(h), - std::forward(t0), - std::forward(tn)...)); - p_.reset(new impl( - beast::bind_front_handler( - std::forward(h), - std::forward(t0), - std::forward(tn)...))); - } - - bool - empty() const noexcept - { - return p_.get() == nullptr; - } - - explicit - operator bool() const noexcept - { - return ! empty(); - } - - void - operator()() - { - auto p = std::move(p_); - (*p)(); - } - - void - reset() - { - p_.reset(nullptr); - } -}; - - -} // detail -} // beast -} // boost - -#endif