| 1 | // |
| 2 | // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) |
| 3 | // |
| 4 | // Distributed under the Boost Software License, Version 1.0. (See accompanying |
| 5 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
| 6 | // |
| 7 | // Official repository: https://github.com/boostorg/beast |
| 8 | // |
| 9 | |
| 10 | #ifndef BOOST_BEAST_CORE_DETAIL_ASYNC_BASE_HPP |
| 11 | #define BOOST_BEAST_CORE_DETAIL_ASYNC_BASE_HPP |
| 12 | |
| 13 | #include <boost/core/exchange.hpp> |
| 14 | |
| 15 | namespace boost { |
| 16 | namespace beast { |
| 17 | namespace detail { |
| 18 | |
| 19 | struct stable_base |
| 20 | { |
| 21 | static |
| 22 | void |
| 23 | destroy_list(stable_base*& list) |
| 24 | { |
| 25 | while(list) |
| 26 | { |
| 27 | auto next = list->next_; |
| 28 | list->destroy(); |
| 29 | list = next; |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | stable_base* next_ = nullptr; |
| 34 | |
| 35 | protected: |
| 36 | stable_base() = default; |
| 37 | virtual ~stable_base() = default; |
| 38 | |
| 39 | virtual void destroy() = 0; |
| 40 | }; |
| 41 | |
| 42 | } // detail |
| 43 | } // beast |
| 44 | } // boost |
| 45 | |
| 46 | #endif |
| 47 | |