Skip to content

Commit

Permalink
fixed pezy#120
Browse files Browse the repository at this point in the history
  • Loading branch information
pezy committed May 13, 2017
1 parent 9305843 commit 5174500
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions ch10/ex10_22.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,28 @@
// @Brief Rewrite the program to count words of size 6 or less using
// functions in place of the lambdas.

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <iostream>
#include <string>
#include <vector>


using std::string;
using namespace std::placeholders;

bool isBiggerThan6(const string& s, string::size_type sz)
bool lessThanOrEqualTo(const string& s, string::size_type sz)
{
return s.size() > sz;
return s.size() <= sz;
}

int main()
{
std::vector<string> authors{"Mooophy", "pezy", "Queequeg90", "shbling",
"evan617"};
std::cout << count_if(authors.cbegin(), authors.cend(),
bind(isBiggerThan6, _1, 6));
bind(lessThanOrEqualTo, _1, 6));
}

// @Out
// 4
// 1

0 comments on commit 5174500

Please sign in to comment.