Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

etl::expected doesn't compile with legacy_variant #1009

Open
Un-done opened this issue Jan 3, 2025 · 0 comments
Open

etl::expected doesn't compile with legacy_variant #1009

Un-done opened this issue Jan 3, 2025 · 0 comments

Comments

@Un-done
Copy link
Contributor

Un-done commented Jan 3, 2025

The expected class uses the variant constructor with 2 Arguments index and value

     ETL_CONSTEXPR14 expected() ETL_NOEXCEPT : storage(etl::in_place_index_t<Value_Type>(), value_type()) { }

This constructor is not implemented for legacy_variant. In my case a simple implementation like

      template <size_t Index, typename T>
      explicit variant(etl::in_place_index_t<Index>, T const& value)
        : type_id(Index)
      {
        ETL_STATIC_ASSERT(Type_Id_Lookup<T>::type_id == Index, "Missmatched type");
        ::new (static_cast<T*>(data)) T(value);
      }

did the job.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant