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

Improved switch wasmtime::Span vs std::span #7

Merged

Conversation

redradist
Copy link
Contributor

@redradist redradist commented Jun 29, 2021

No description provided.

…switching between wasmtime::Span and std::span
@alexcrichton
Copy link
Member

I'm personally historically wary of patterns like this because it seems like you can create subtle dependencies one one mode or another. Do you know if that's possible here, or is this a common pattern in C++?

@redradist
Copy link
Contributor Author

@alexcrichton It is common pattern if we do not have currently std::span
After yesterday implementation I though little-bit and found case where implicit conversion did not work:

auto span = call_function(); // It will be wasmtime::Span but user want to use full `std::span` with all available API

With template alias if user has C++20 then it automatically will have span class with all available api
wasmtime::Span compatible with the subset API of std::span

@alexcrichton
Copy link
Member

Ok seems reasonable to me, thanks again!

@alexcrichton alexcrichton merged commit 69829db into bytecodealliance:main Jun 30, 2021
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

Successfully merging this pull request may close these issues.

2 participants