Skip to content

Conversation

@oldnewthing
Copy link
Member

The boxing and unboxing functions now support most kinds of arrays. The notable exception is arrays of enumerations. Nothing technically preventing it. Just lazy.

You can box and unbox arrays nearly anywhere you could box and unbox scalars, with one exception: You cannot unbox arrays with unbox_value_or. The reason is that com_array is not copyable, and unbox_value_or returns a copy of its second parameter on failure. We could try to address this by having unbox_value_or accept its second parameter as an array_view when asked to unbox an array type. But I didn't try. Just lazy.

One annoyance is the treatment of com_array<GUID>. This is identical to com_array<guid> but I had to play games to convert between them efficiently. Maybe it wasn't worth it. Perhaps I should have been lazy.

The boxing and unboxing functions now support most kinds of arrays.
The notable exception is arrays of enumerations. Nothing technically
preventing it. Just lazy.

You can box and unbox arrays nearly anywhere you could box and
unbox scalars, with one exception: You cannot unbox arrays with
`unbox_value_or`. The reason is that `com_array` is not copyable,
and `unbox_value_or` returns a copy of its second parameter on failure.
We could try to address this by having `unbox_value_or` accept
its second parameter as an `array_view` when asked to unbox an
array type. But I didn't try. Just lazy.

One annoyance is the treatment of `com_array<GUID>`. This is
identical to `com_array<guid>` but I had to play games to convert
between them efficiently. Maybe it wasn't worth it. Perhaps I should
have been lazy.
@oldnewthing oldnewthing requested a review from kennykerr March 26, 2021 14:37
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.

Thanks!

@kennykerr kennykerr merged commit 2073422 into master Mar 26, 2021
@kennykerr kennykerr deleted the try-as-array branch March 26, 2021 17:35
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.

3 participants