Skip to content

all unique_any simple memory patterns are false, they don't use unique_any #546

@diablodale

Description

@diablodale

All 16 template types at https://github.com/Microsoft/wil/wiki/RAII-resource-wrappers#available-unique_any-simple-memory-patterns are wrongly documented. The entire section is false. Instead, those 16 are correctly documented at https://github.com/Microsoft/wil/wiki/RAII-resource-wrappers#wistdunique_ptr

Setup

In browser to go https://github.com/microsoft/wil/wiki

Repro

wil::unique_hlocal_ptr<SPC_SP_OPUS_INFO> opus_info;
opus_info.put()

Result

class "wistd::unique_ptr<SPC_SP_OPUS_INFO, wil::hlocal_deleter>" has no member "put"

Workaround

wil::unique_hlocal_ptr<SPC_SP_OPUS_INFO> opus_info;
wil::out_param(opus_info);

Notes

While coding with wil v1.0.250325.1 Cryptxxx apis and the CRYPT_DECODE_ALLOC_FLAG I saw that wil::unique_hlocal_ptr won't work because it doesn't have operator& or .put(). Yet the documentation at https://github.com/Microsoft/wil/wiki/RAII-resource-wrappers#available-unique_any-simple-memory-patterns clearly lists it and 15 other types as "unique_any template types..."

Turns out, doc is wrong. All 16 are not wil::unique_any template types. Instead, they are wistd::unique_ptr template types. Very different. And lacking all out and in/out parameter functionality -- no &, put, addressof, etc.

Easy fix is to delete the entire section. Those 16 types are correctly documented far below at https://github.com/Microsoft/wil/wiki/RAII-resource-wrappers#wistdunique_ptr

An enhancement would be to create 16 new wil::unique_any template types for each and update the doc for them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions