winrt::name_of函式範本 (C++/WinRT)

協助程式函式,可擷取字串檢視,其中包含特定Windows 執行階段類別的完整型別名稱。

name_of 最適合投影類型。 如果您指定實作類型,則 name_of 傳回預設介面的字串化 GUID。

語法

template <typename T>
constexpr auto name_of() noexcept;

範本參數

typename T 投影介面或執行時間類別類型。

傳回值

結尾以外的 null 結束字元字串檢視。

範例

if (ApiInformation.IsMethodPresent(
      winrt::name_of<Windows::Devices::PointOfService::ReceiptPrintJob>(),
      L"FeedPaperByLine")) {
  ...
}

規格需求

最低支援的 SDK:Windows SDK 10.0.17134.0 版 (Windows 10版本 1803)

命名空間: winrt

標頭: %WindowsSdkDir%IncludeWindowsTargetPlatformVersion <> \cppwinrt\winrt\base. (h 預設包含)

另請參閱