Closed tom-huntington closed 2 months ago
I would argue against this because:
I'm not opposed to the idea, but it would need a different name.
Since every variable is a length one array maybe as_const_c_array
. This might be a bit inconsistent with the existing as
/try_as
methods. view_as_const
, const_view
?
Feel free to close if this is more bikeshedding than it is worth.
1-1 functionality with WRL::ComPtr
would be nice though.
Something like addressof() would work better - and it's also the name used by wil. Have you considered using wil for your com_ptr?
Also I will point out that WRL::ComPtr
's operator&
does release the held object as well, according to docs.
I believe the WIL version has a lot more bells and whistles.
Most D3D APIs take a
T *const *ppT
parameter (i.e. an array of pointers). WithWRL::ComPtr
you could useGetAddressOf
to get the argument to parse. C++/WinRT'scom_ptr::put
releases its reference before passing you a pointer to what it owns.Which is safe, but this means you have to do the following dance when parsing only one pointer
which is unnecessarily verbose, as you could provide