Namespaces
Variants
Views
Actions

Template:ls

From cppreference.com
no section name
[edit] [{{purge}}] Template documentation

This is one of templates used to make links.

Contents

[edit] Absolute links

[edit] Normal font

{{lt|path |title (optional)}} - creates a link to a page using absolute path. The default title is only the last part of the path.

Example: {{lt|cpp/language/statements}} results in the link: statements.
Example: {{lt|cpp/language/statements|Labeled statements}} results in the link: Labeled statements.
Note: the previous example is just another way to create the same link using the standard template
[[cpp/language/statements|Labeled statements]], which also results in Labeled statements.

{{ls|path#section }} - makes a link to a section (anchor) on a page given by absolute path. The section text is also used as the title. To create a link on the same page the path part should be empty.

Example: {{ls|cpp/language/lambda#Syntax}} results in the link: Syntax.
To create a link to a section/anchor within the current page the path part should be omitted.
Example: {{ls|#Relative links}} results in the link: Relative links (i.e. a link to the section in this page).

{{lsd|path#Section }} ("lsd" stands for "Link to Section De-capitalized") - almost the same as {{ls}} except it de-capitalizes the first letter of displayed section name. To create a link on the same page the path part should be empty.

Example: {{lsd|cpp/language/array#Arrays of unknown bound}} results in the link: arrays of unknown bound.
Example: {{lsd|#Relative links}} results in the link: relative links (i.e. a link to the section in this page).

[edit] Teletype font

{{ltt|path |title (optional)}} - creates a link to a page using absolute path. The default title is only the last part of the path.

Example: {{ltt|cpp/language/switch}} results in the link: switch.
Example: {{ltt|cpp/language/switch|switch(expr)}} results in the link: switch(expr).

{{ltf|path |title (optional)|args=arguments (optional)}} - creates a link to a page using absolute path. The default title is only the last part of the path. Parentheses indicating function are appended, which enclose the optional arguments.

Example: {{ltf|cpp/error/terminate}} results in the link: terminate().
Example: {{ltf|cpp/error/terminate|std::terminate}} results in the link: std::terminate().
Example: {{ltf|cpp/error/set_terminate|std::set_terminate|args=nullptr}} results in the link: std::set_terminate(nullptr).

{{ltp|path |title (optional)|targs=template arguments (optional)}} - creates a link to a page using absolute path. The default title is only the last part of the path. Angle brackets indicating template are appended, which enclose the optional template arguments.

Example: {{ltp|cpp/container/vector}} results in the link: vector<>.
Example: {{ltp|cpp/container/vector|targs=int}} results in the link: vector<int>.
Example: {{ltp|cpp/container/vector|targs=std::size_t}} results in the link: vector<std::size_t>.

{{ltpf|path |title (optional)|targs=template arguments (optional)|args=arguments (optional)}} - creates a link to a page using absolute path. The default title is only the last part of the path. Angle brackets indicating template are appended, which enclose the optional template arguments. After that, parentheses indicating function are appended, which enclose the optional arguments.

Example: {{ltpf|cpp/container/vector/vector|targs=int|args=5}} results in the link: vector<int>(5).
Example: {{ltpf|cpp/locale/use_facet|targs=Facet|args=loc}} results in the link: use_facet<Facet>(loc).

{{lst|path#section }} - makes a link to a section (anchor) on a page given by absolute path. The section text is also used as the title. To create a link on the same page the path part should be empty.

Example: {{lst|cpp/ranges#maybe-const}} results in the link: maybe-const.
Example: {{lst|#top}} results in the link: top.
Example: {{lst|#top_}} results in the link: top_ (note that the trailing underscore character of the link is automatically trimmed).

{{l2tt|page |title1 (optional)|title2 (optional)}} - creates a link to a page using absolute path. The title is formed from the two last parts of the path with :: be inserted between them. Each of these parts can be overridden by title1 and title2.

Example: {{l2tt|cpp/container/vector/size}} results in the link: vector::size.
Example: {{l2tt|cpp/container/vector/size|size() const}} results in the link: vector::size() const.
Example: {{l2tt|cpp/container/vector/size|size()|std::vector<T>}} results in the link: std::vector<T>::size().

{{l2tf|page |title1 (optional)|title2 (optional)|args=arguments (optional)|suffix=suffix (optional)}} - creates a link to a page using absolute path. The title is formed from the two last parts of the path with :: be inserted between them. Each of these parts can be overridden by title1 and title2. Parentheses indicating function are appended, which enclose the optional arguments and are followed by the optional suffix.

Example: {{l2tf|cpp/container/vector/size}} results in the link: vector::size().
Example: {{l2tf|cpp/container/vector/size|suffix=const}} results in the link: vector::size() const.
Example: {{l2tf|cpp/container/vector/size|size|std::vector<T>}} results in the link: std::vector<T>::size().

[edit] Italic teletype font

{{lti|path |title (optional)}} - creates a link to a page using absolute path. The default title is only the last part of the path.

Example: {{lti|cpp/concepts/boolean-testable}} results in the link: boolean-testable.

{{ltpi|path |title (optional)|targs=template arguments (optional)}} - creates a link to a page using absolute path. The default title is only the last part of the path. Angle brackets indicating template are appended, which enclose the optional template arguments.

Example: {{ltpi|cpp/concepts/boolean-testable}} results in the link: boolean-testable <>.
Example: {{ltpi|cpp/concepts/boolean-testable|targs=int}} results in the link: boolean-testable <int>.

{{lsi|path#section }} - makes a link to a section (anchor) on a page given by absolute path. The section text is also used as the title. To create a link on the same page the path part should be empty.

Example: {{lsi|cpp/ranges#maybe-const}} results in the link: maybe-const.
Example: {{lsi|#top}} results in the link: top.
Example: {{lsi|#top_}} results in the link: top_ (note that the trailing underscore character of the link is automatically trimmed).

[edit] Absolute links with prefix std::

The following convenience templates generate links whose titles begin with std::. They can be used in places where {{lc}} fails to generate a link. All links appear in teletype font.

{{ltt std|path }} - link to a page using absolute path. The title is std:: followed by the last part of the path.

Example: {{ltt std|cpp/container/mdspan}} results in the link: std::mdspan.

{{ltf std|path }} - link to a page using absolute path. The title is std:: followed by the last part of the path and parentheses indicating function.

Example: {{ltf std|cpp/io/print}} results in the link: std::print().

{{l2tt std|path }} - link to a page using absolute path. The title is std:: followed by the last two parts of the path joined by ::.

Example: {{l2tt std|cpp/utility/basic_stacktrace/current}} results in the link: std::basic_stacktrace::current.

{{l2tf std|path }} - link to a page using absolute path. The title is std:: followed by the last two parts of the path joined by :: and parentheses indicating function.

Example: {{l2tf std|cpp/utility/expected/value}} results in the link: std::expected::value().

[edit] Relative links

[edit] Normal font

{{rl|page |title (optional)}} - makes a link to a page relative to this page (i.e. to a sub-page).

{{rlp|page |title (optional)}} - makes a link to a page relative to the parent page.

{{rlp|/ |title }} - makes a link to the parent page.

{{rlps|page#section }} - makes a link to a section (anchor) on a page relative to the parent page. The title of the generated link is the section name.

{{rlpsd|page#Section }} - makes a link to a section (anchor) on a page relative to the parent page. The title of the generated link is the section name with the first letter de-capitalized.

[edit] Teletype font

{{rlt|page |title (optional)}} - makes a link to a page relative to this page (i.e. to a sub-page).

{{rlpt|page |title (optional)}} - makes a link to a page relative to the parent page.

{{rlpt|/ |title }} - makes a link to the parent page.

{{rlpf|page |title (optional)|args=arguments (optional)}} - makes a link to a page relative to the parent page. Parentheses indicating function are appended, which enclose the optional arguments.

{{rlpst|page#section }} - makes a link to a section (anchor) on a page relative to the parent page. The title of the generated link is the section name.

{{ttt|identifier }} - makes a link to the current page (via the #top link).

Example: {{ttt|this_page}} results in this_page.

[edit] Italic teletype font

{{rli|page |title (optional)}} - makes a link to a page relative to this page (i.e. to a sub-page).

{{rlpi|page |title (optional)}} - makes a link to a page relative to the parent page.

{{rlpi|/ |title }} - makes a link to the parent page.

{{rlpsi|page#section }} - makes a link to a section (anchor) on a page relative to the parent page. The title of the generated link is the section name.

[edit] Decorated links

{{attr|attribute |title (optional)|additional title (optional)|lang=language (optional)}}

Used to create a link to C/C++ language attribute specifier description. Parameters:
  • attribute - an attribute specifier name.
  • title - an attribute specifier title.
  • additional title - additional elements after the title.
  • language - cpp or c. If language is not given, {{get lang}} is used.
Example: {{attr|assume}} results in [[assume]].
Example: {{attr|noreturn|_Noreturn|lang=c}} results in [[_Noreturn]].
Example: {{attr|deprecated|3=("because")}} results in [[deprecated("because")]].