Skip to content

Latest commit

 

History

History
48 lines (36 loc) · 1.41 KB

File metadata and controls

48 lines (36 loc) · 1.41 KB
description title dev_langs ms.date ms.topic keywords ms.workload
A helper function that retrieves a string view containing the fully-qualified type name of a particular Windows Runtime class.
winrt::name_of function template (C++/WinRT)
C++
03/10/2021
language-reference
windows 10, uwp, standard, c++, cpp, winrt, projection, api, reference, projected, implementation, type
cplusplus

winrt::name_of function template (C++/WinRT)

A helper function that retrieves a string view containing the fully-qualified type name of a particular Windows Runtime class.

name_of works best with a projected type. If you specify an implementation type, then name_of returns the stringified GUID of the default interface.

Syntax

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

Template parameters

typename T A projected interface or runtime class type.

Return value

A string view with a null-terminator beyond the end.

Example

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

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)

See also