Namespaces
Variants
Views
Actions

Template:feature test macro

From cppreference.com
Revision as of 09:22, 27 June 2022 by Space Mission (Talk | contribs)

Feature testing macro: {{{1}}}
[edit] [{{purge}}] Template documentation

Contents

WG21

Generates a link to a document of C++ Working Group (WG21), that is CWG/LWG page or a "proposal" file, respectively.

{{wg21|CWG or LWG or WG21 document-number |full (optional)}}

The full (optional) argument works only with "proposal" documents, and applying it results in the generation of an additional link to GitHub page (where the proposal is processed by WG21).
  • Example: {{wg21|CWG613}} results in CWG613
  • Example: {{wg21|LWG2844}} results in LWG2844
  • Example: {{wg21|P1938R2}} results in P1938R2
  • Example: (to make a link to the latest revision of the proposal) {{wg21|P1938}} results in P1938
  • Example: {{wg21|P1938|full}} results in P1938 (github)

stddoc

Used to generate a link to a document of WG14/WG21.

The WG/language (C or C++) is determined by {{get lang}}, unless the lang (optional) argument with a value c or cpp is provided (if supported).

{{stddoc|document number |link title (optional)|lang=lang (optional)}}

Generate a link to a WG14/WG21 document with the given document number. A custom link title can be provided, it is the capitalized document number by default. In C mode, document number can contain a file extension, e.g. n2081.htm. In C++ mode, there is no need to know/pass the extension due to wg21.link service automation.
  • Example: {{stddoc|p2443r1}} results in: P2443R1
  • Example: {{stddoc|P2443R1|views::chunk_by}} results in: views::chunk_by
  • Example: {{stddoc|n2731|C23 draft|lang=c}} results in: C23 draft
  • Example: {{stddoc|n2081.htm|n2081|lang=c}} results in: n2081

{{stddoc latest draft|link title (optional)|lang=lang (optional)}}

Generate a link to the latest draft of the next C/C++ standard.
  • Presently, {{stddoc latest draft}} results in: N4993
  • Presently, {{stddoc latest draft|Latest C++ draft}} results in: Latest C++ draft
  • Presently, {{stddoc latest draft|Latest C draft|lang=c}} results in: Latest C draft

stdinfo

Used to provide information of C/C++ standardization.

The language (C or C++) is determined by {{get lang}}, unless the lang (optional) argument with a value c or cpp is provided (if supported).

{{stdinfo latest draft|rev or doc or date |lang=lang (optional)}}

Is a hub for C/C++ standard draft information. Depending on the value of the first argument, the returned info is:
value info Example
rev version number {{stdinfo latest draft|rev}} results in 26

{{stdinfo latest draft|rev|lang=c}} results in 2y

doc document number {{stdinfo latest draft|doc}} results in n4993

{{stdinfo latest draft|doc|lang=c}} results in n3301

date document date {{stdinfo latest draft|date}} results in 2024-10-16

{{stdinfo latest draft|date|lang=c}} results in 2024-07-28

Is used inside the following higher-level templates:
{{stdinfo latest draft docnum}}, {{stdinfo latest draft docdate}}, {{stdinfo next version number}}, {{stdinfo next version}}.

{{stdinfo latest draft docnum|lang=lang (optional)}}

The document number of the latest draft of the C/C++ standard.
  • For C results in n3301.
  • For C++ results in n4993.

{{stdinfo latest draft docdate|lang=lang (optional)}}

The document date of the latest draft of the C/C++ standard.
  • For C results in 2024-07-28.
  • For C++ results in 2024-10-16.

{{stdinfo next version number|lang=lang (optional)}}

The version number of the next C/C++ standard.
  • For C results in 2y.
  • For C++ results in 26.

{{stdinfo next version}}

The version of the next C/C++ standard (with the prefix C or C++). Results in: C++

{{stdinfo current version number}}

The version number of the current C/C++ standard. Results in: 20

{{stdinfo current version}}

The version of the current C/C++ standard (with the prefix C or C++). Results in: C++20

Current language

Returns the programming language to use for a page by default. The output value depends on the title of the page this template is included in.

{{get lang}}

If the page title begins with "c/", then the output value is "c", if the page title begins with "cpp/", then the output value is "cpp". Otherwise the output value is "cpp".

{{get lang formal}}

If the page title begins with "c/", then the output value is "C", if the page title begins with "cpp/", then the output value is "C++". Otherwise the output value is "C++".