Template talk:par range
From cppreference.com
Questions
- How do add iterator properties (input, forward, bidirectional, random_access, etc.) and range properties (sorted, partially sorted, containing a heap, etc.)?
- How do add the description of using the template to the documentation?
{{par|{{ttb|{{{1|first}}}, {{{2|last}}}}}|the {{#if: {{{sentinel|}}}|iterator-sentinel pair|pair of iterators}} defining the [[cpp/iterator#Ranges|range]] of elements {{{3|to...}}}}} <noinclude>{{documentation|Template:par/doc}}</noinclude>
Answers
- Could you give sample links to what you expect to get, if it's an existing design style. Or it is something novel?
- In the {{par range}} case you can edit Template:par/doc page (see my last changes: [1], [2]).
- --Space Mission (talk) 04:17, 10 February 2025 (PST)
- PS. After recent update of {{par range}}'s
sentinel=yesparameter and since addingrange='range kind'one, (almost?) all iterator/sentinel pairs of STL algorithms can be described using {{par range}}, so you may continue to work on them. :-) --Space Mission (talk) 07:30, 10 February 2025 (PST)
A thought comes only after (c)Dmi3 (talk) 05:20, 13 February 2025 (PST)
Maybe it would be better to create:
{{par range}}
{{par range counted}}
{{par range sentinel}}
based on {{par range/core}}?
- I agree, several specialized templates is a better approach, and this would correspond to the existing practice, e.g., {{range/core}} → {{range}} → {{closed range}} etc. If you are ready to participate in updating at least algorithms pages with such new templates, I can implement that
{{par...}}family. The updates also can be done with the help of regexps. --Space Mission (talk) 01:25, 14 February 2025 (PST)- I'm ready (ONLY for the algorithm library). But soon I will have very little time. Do we need such a template? {{par range one}} for
std::range::A_METHODS(R& r,...);P.S. I don't know how to do updates with regular expressions. :-( Dmi3 (talk) 02:12, 14 February 2025 (PST) - I think I'm ✔ Done. But std::inplace_merge and ranges::inplace_merge couldn't do it. You can try to update using regular expressions. I'm done... :-) Dmi3 (talk) 04:04, 15 February 2025 (PST)
- Okay, thanks for your contrib.) --Space Mission (talk) 09:42, 15 February 2025 (PST)
- I'm ready (ONLY for the algorithm library). But soon I will have very little time. Do we need such a template? {{par range one}} for
Self-consistency
Is it possible to make the default value of a template parameter change automatically?
"sentinel=yes" for the ranges library
"items=characters" for the strings library
Or somehow achieve a similar effect by other means? Dmi3 (talk) 09:49, 18 February 2025 (PST)
- Sort of, yes, it is possible. We can play with path functions like
{{SUBPAGENAMEE}}and MediaWiki's string parsing functions, e.g., for strings library we can detect the word "string" in the path and substitute "elements" with "characters". :-) --Space Mission (talk) 08:47, 23 February 2025 (PST)