winrt::make_self function template (C++/WinRT)
A factory method that returns a com_ptr to an instance of the implementation type for a runtime class. For an explanation of the implementation type and projected type concepts, see Consume APIs with C++/WinRT and Author APIs with C++/WinRT. Also see make, which returns an instance of the projected type instead.
If you're authoring a runtime class then, from within the same compilation unit, you can use make_self to construct an instance of the implementation type for the runtime class. Assign the return value from make_self to a com_ptr of your implementation type so that you manage the lifetime of the object appropriately.
Also see Opt in to uniform construction, and direct implementation access.
Syntax
template <typename D, typename... Args>
auto make_self(Args&&... args);
Template parameters
typename D
The implementation type for a runtime class.
Parameters
args
Any constructor arguments for the constructor being invoked.
Return value
A com_ptr to a newly-created instance of the implementation type for the runtime class.
Requirements
Minimum supported SDK: Windows SDK version 10.0.17134.0 (Windows 10, version 1803)
Namespace: winrt
Header: %WindowsSdkDir%Include<WindowsTargetPlatformVersion>\cppwinrt\winrt\base.h (included by default)