diff --git a/include/beman/execution/detail/poly.hpp b/include/beman/execution/detail/poly.hpp deleted file mode 100644 index 33358bd5a..000000000 --- a/include/beman/execution/detail/poly.hpp +++ /dev/null @@ -1,79 +0,0 @@ -// include/beman/execution/detail/poly.hpp -*-C++-*- -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -#ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_POLY -#define INCLUDED_BEMAN_EXECUTION_DETAIL_POLY - -#include -#include -#include -#include -#include - -// ---------------------------------------------------------------------------- - -namespace beman::execution::detail { -/*! - * \brief Utility providing small object optimization and type erasure. - * \headerfile beman/execution/task.hpp - * \internal - */ -template -class alignas(sizeof(double)) poly { - private: - std::array buf{}; - - Base* pointer() { return static_cast(static_cast(buf.data())); } - const Base* pointer() const { return static_cast(static_cast(buf.data())); } - - public: - template - requires(sizeof(T) <= Size) - poly(T*, Args&&... args) { - new (this->buf.data()) T(::std::forward(args)...); - static_assert(sizeof(T) <= Size); - } - poly(poly&& other) - requires requires(Base* b, void* t) { b->move(t); } - { - other.pointer()->move(this->buf.data()); - } - poly& operator=(poly&& other) - requires requires(Base* b, void* t) { b->move(t); } - { - if (this != &other) { - this->pointer()->~Base(); - other.pointer()->move(this->buf.data()); - } - return *this; - } - poly& operator=(const poly& other) - requires requires(Base* b, void* t) { b->clone(t); } - { - if (this != &other) { - this->pointer()->~Base(); - other.pointer()->clone(this->buf.data()); - } - return *this; - } - poly(const poly& other) - requires requires(Base* b, void* t) { b->clone(t); } - { - other.pointer()->clone(this->buf.data()); - } - ~poly() { this->pointer()->~Base(); } - bool operator==(const poly& other) const - requires requires(const Base& b) { - { b.equals(&b) } -> std::same_as; - } - { - return other.pointer()->equals(this->pointer()); - } - Base* operator->() { return this->pointer(); } - const Base* operator->() const { return this->pointer(); } -}; -} // namespace beman::execution::detail - -// ---------------------------------------------------------------------------- - -#endif diff --git a/src/beman/execution/CMakeLists.txt b/src/beman/execution/CMakeLists.txt index de4f5e8e8..e80b8c844 100644 --- a/src/beman/execution/CMakeLists.txt +++ b/src/beman/execution/CMakeLists.txt @@ -162,7 +162,6 @@ target_sources( ${PROJECT_SOURCE_DIR}/include/beman/execution/detail/parallel_scheduler.hpp ${PROJECT_SOURCE_DIR}/include/beman/execution/detail/parallel_scheduler_replacement.hpp ${PROJECT_SOURCE_DIR}/include/beman/execution/detail/product_type.hpp - ${PROJECT_SOURCE_DIR}/include/beman/execution/detail/poly.hpp ${PROJECT_SOURCE_DIR}/include/beman/execution/detail/promise_env.hpp ${PROJECT_SOURCE_DIR}/include/beman/execution/detail/prop.hpp ${PROJECT_SOURCE_DIR}/include/beman/execution/detail/query_with_default.hpp