Add support for boxing and unboxing most kinds of arrays #903
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 thatcom_arrayis not copyable, andunbox_value_orreturns a copy of its second parameter on failure. We could try to address this by havingunbox_value_oraccept its second parameter as anarray_viewwhen 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 tocom_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.