Skip to content

vector<bool> and groupby #58

@miguel-negrao

Description

@miguel-negrao

Hi

I'm getting another strange behaviour:

  vector<bool> v{true, true, false, false,false, true, true};
  for (auto &&x: iter::groupby(v,[](auto b){return b;})) {
    cout << "group: ";
    for (auto &&g: x.second)
      cout << g << " ";
    cout << endl;
  }

prints

group: 1 1 0 0 0 1 1 

yet

  vector<int> v{5,5,5,3,3};
  for (auto &&x: iter::groupby(v,[](auto b){return b;})) {
    cout << "group: ";
    for (auto &&g: x.second)
      cout << g << " ";
    cout << endl;
  }

prints

group: 5 5 5 
group: 3 3

Is there a reason why it shouldn't work with bool ?

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions