Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

adjacent_filtered's postcondition doesn't correctly describe behaviour

Open
#81 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
1-3 hours
Newbie friendliness
52/100
Issue type
Documentation
Clarity
Clearly specified
Activity status
Stale
Tech stack
cpp
Domain
documentation

Research direction

Open the adjacent_filtered reference documentation linked in the issue and locate its postcondition. Compare that statement with the provided C++ example, revise the wording to match the demonstrated behavior, and verify that the rendered documentation accurately describes the invariant.

Written by the indexing model from the issue text.

Description

I think the documentation for adjacent_filtered's postcondition, ie:

For all adjacent elements [x,y] in the returned range, bi_pred(x,y) is true.

…isn't quite right. For example, this:

#include <boost/range/adaptor/adjacent_filtered.hpp>

#include <iostream>
#include <vector>

int main() {
   const std::vector<int> a = { 0, 1, 2, 3, 4, 5, 6 };

   const auto b = a | boost::adaptors::adjacent_filtered(
      [] (const int &x, const int &y) {
         return ( y % 2 == 1 ) && ( y == x + 1 );
      }
   );
   for (const auto &x : b) {
      std::cerr << x << "\n";
   }
}

…outputs:

0
1
3
5

Yet two of the pairs of adjacent elements [x,y] in this range fail bi_pred(x,y) (because they differ by 2, not 1).

I think it's more like: bi_pred is true on each element in the returned range preceded by the element that preceded it in the original range (not in the returned range).

Dominant language
C++
Stars
45
Forks
104
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from boostorg/range

All issues in boostorg/range

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.