* @brief Destroy the eventually object and the contained object. */
| 3565 | * @brief Destroy the eventually object and the contained object. |
| 3566 | */ |
| 3567 | ~basic_eventually() noexcept { |
| 3568 | if constexpr (implicit_state) { |
| 3569 | if constexpr (Exception) { |
| 3570 | std::destroy_at(std::addressof(m_exception)); |
| 3571 | } else { |
| 3572 | // T* is trivially destructible. |
| 3573 | } |
| 3574 | } else { |
| 3575 | switch (m_flag) { |
| 3576 | case state::empty: |
| 3577 | return; |
| 3578 | case state::value: |
| 3579 | if constexpr (!is_void) { |
| 3580 | std::destroy_at(std::addressof(m_value)); |
| 3581 | return; |
| 3582 | } else { |
| 3583 | lf::impl::unreachable(); |
| 3584 | } |
| 3585 | case state::exception: |
| 3586 | if constexpr (Exception) { |
| 3587 | std::destroy_at(std::addressof(m_exception)); |
| 3588 | return; |
| 3589 | } else { |
| 3590 | lf::impl::unreachable(); |
| 3591 | } |
| 3592 | default: |
| 3593 | lf::impl::unreachable(); |
| 3594 | } |
| 3595 | } |
| 3596 | } |
| 3597 | // ----------------------- Check state ----------------------- // |
| 3598 | |
| 3599 | /** |
nothing calls this directly
no test coverage detected