Skip to content

[doc] Fix the parameter names documented for is_permutation - #131

Merged
mclow merged 1 commit into
boostorg:developfrom
karpovantonme:doc-is-permutation-param-names
Aug 4, 2026
Merged

[doc] Fix the parameter names documented for is_permutation#131
mclow merged 1 commit into
boostorg:developfrom
karpovantonme:doc-is-permutation-param-names

Conversation

@karpovantonme

Copy link
Copy Markdown
Contributor

The three-argument is_permutation overload documents a parameter it does not have:

/// \fn is_permutation ( ForwardIterator1 first, ForwardIterator1 last, ForwardIterator2 first2 )
///
/// \param first1   The start of the input sequence
/// \param last2    One past the end of the input sequence     <-- last1
/// \param first2   The start of the second sequence
template< class ForwardIterator1, class ForwardIterator2 >
bool is_permutation ( ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2 )

last2 is not a parameter — it is a local variable computed inside the body (ForwardIterator2 last2 = first2; std::advance(...)), which is presumably how it got into the comment. The four-argument overload twenty lines above documents last1 correctly, so the two overloads describe the same parameter differently.

Both \fn lines in the file also spell the first two parameters first and last, while the declarations use first1 and last1. Doxygen matches \fn against the declaration, so those names should agree too.

Comments only, one file.

Found while sweeping, not included

The same check — every \param/\tparam name in a Doxygen block against the actual signature — turns up a few more in this library and its neighbours:

  • boost/algorithm/string/formatter.hpp, empty_formatter documents \param Input while the parameter in the declaration is unnamed (empty_formatter(const RangeT&)).
  • Boost.GIL has 42 such mismatches, Boost.Histogram 25, mostly \param names that were renamed in the signature.

I kept this PR to is_permutation. If the rest is worth fixing, say so in a comment and I will send them — per library, so each stays reviewable — or tell me a given one is intentional and I will leave it alone.

The three-argument overload documents `\param last2`, but its parameters
are `first1`, `last1`, `first2` — `last2` is a local variable computed
inside the body. The four-argument overload right above it documents
`last1` correctly.

Both `\fn` lines also spell the first two parameters `first` and `last`
while the declarations use `first1` and `last1`.
@mclow

mclow commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

You should prepare a PR for boost.GIL. I can fix the string one myself.
Thanks!

@karpovantonme

Copy link
Copy Markdown
Contributor Author

Thanks for merging.

Two corrections to the numbers I quoted in the description, before you act on them. I wrote that Boost.GIL has 42 such mismatches and Boost.Histogram 25. Both came from an early version of my checker that mis-parsed operator(), decltype(auto) and macros in return types, so a good part of those counts was the tool failing rather than real mismatches. After fixing the parser the honest numbers are 11 for GIL and 3 for Histogram.

GIL is done: Mateusz merged boostorg/gil#792 this morning, which covered the core headers, and I have just sent boostorg/gil#793 for io and the extensions. Nine of the 11 there are verified by hand. The other two turned out to be my parser reading const in FormatTag const& as a parameter name, so I left them and said as much in the PR rather than quietly padding the count.

Histogram is at boostorg/histogram#443, three \tparam names.

Leaving string/formatter.hpp to you, as you said.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants