Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Merged
jonwis merged 8 commits intomicrosoft:mastermicrosoft/cppwinrt:masterfrom
jonwis:user/jonwis/update-juv-studiosjonwis/cppwinrt:user/jonwis/update-juv-studiosCopy head branch name to clipboard
Aug 28, 2023
Merged

Support for std::span for winrt::array_view and winrt::com_array#1343
jonwis merged 8 commits intomicrosoft:mastermicrosoft/cppwinrt:masterfrom
jonwis:user/jonwis/update-juv-studiosjonwis/cppwinrt:user/jonwis/update-juv-studiosCopy head branch name to clipboard

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.

@jonwis jonwis requested review from dmachaj and kennykerr August 19, 2023 04:04
test/test_cpp20/array_span.cpp Show resolved Hide resolved
strings/base_array.h Show resolved Hide resolved
@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
@jonwis jonwis requested review from ChrisGuzak and kennykerr August 28, 2023 04:54
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
@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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.