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

Support for std::span for winrt::array_view and winrt::com_array #1343

Merged
merged 8 commits into from
Aug 28, 2023

Conversation

jonwis
Copy link
Member

@jonwis jonwis commented Aug 19, 2023

This fixes #1289 per "option C" by completing what #1331 started.

  • Constructors for both array_view and com_array that take a span
  • Conversions on both array_view and com_array that produce a span
  • Tests for the conversions and constructions
  • Additional ctad support for easy use

@JaiganeshKumaran thank you for the initial start - see if this meets your needs, please.

@kennykerr
Copy link
Collaborator

Hopefully @DefaultRyan can spare a few minutes to look this over. He probably has the best handle on the standard library best practices.

strings/base_array.h Outdated Show resolved Hide resolved
Copy link
Collaborator

@kennykerr kennykerr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still think the lifetime here is bonkers, but admittedly not any worse than the C++ standard library.

@jonwis jonwis merged commit 691f6f8 into microsoft:master Aug 28, 2023
75 checks passed
@jonwis jonwis deleted the user/jonwis/update-juv-studios branch August 28, 2023 17:24
@dmachaj
Copy link
Contributor

dmachaj commented Aug 28, 2023

Sorry I'm a little late to the party. Do these new methods affect vtable layout at all? In other words, does span support need an ODR pragma to prevent mismatches?

@kennykerr
Copy link
Collaborator

Do these new methods affect vtable layout at all?

std::span is not an ABI type.

@jonwis
Copy link
Member Author

jonwis commented Aug 28, 2023

It's pure conversion methods; no change to the layout or functionality of array_view or com_array here.

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.

Allow passing array_view as span
5 participants