| 16 | }; |
| 17 | |
| 18 | struct vtable { |
| 19 | void (*move_destroy_fn)(void* src, void* dst) noexcept; |
| 20 | void (*execute_destroy_fn)(void* target); |
| 21 | void (*destroy_fn)(void* target) noexcept; |
| 22 | |
| 23 | vtable(const vtable&) noexcept = default; |
| 24 | |
| 25 | constexpr vtable() noexcept : move_destroy_fn(nullptr), execute_destroy_fn(nullptr), destroy_fn(nullptr) {} |
| 26 | |
| 27 | constexpr vtable(decltype(move_destroy_fn) move_destroy_fn, |
| 28 | decltype(execute_destroy_fn) execute_destroy_fn, |
| 29 | decltype(destroy_fn) destroy_fn) noexcept : |
| 30 | move_destroy_fn(move_destroy_fn), |
| 31 | execute_destroy_fn(execute_destroy_fn), destroy_fn(destroy_fn) {} |
| 32 | |
| 33 | static constexpr bool trivially_copiable_destructible(decltype(move_destroy_fn) move_fn) noexcept { |
| 34 | return move_fn == nullptr; |
| 35 | } |
| 36 | |
| 37 | static constexpr bool trivially_destructible(decltype(destroy_fn) destroy_fn) noexcept { |
| 38 | return destroy_fn == nullptr; |
| 39 | } |
| 40 | }; |
| 41 | |
| 42 | template<class callable_type> |
| 43 | class callable_vtable { |