Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
pezy committed Apr 24, 2015
1 parent 110b36c commit 5fc880c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ch10/ex10_32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ int main()

while (in_iter != in_eof)
vec.push_back(*in_iter++);
sort(vec.begin(), vec.end(), compareIsbn);
sort(vec.begin(), vec.end(), [](Sales_item const& lhs, Sales_item const& rhs){ return lhs.isbn() < rhs.isbn(); });
for (auto beg = vec.cbegin(), end = beg; beg != vec.cend(); beg = end) {
end = find_if(beg, vec.cend(), [beg](const Sales_item &item){return item.isbn() != beg->isbn();});
std::cout << std::accumulate(beg, end, Sales_item(beg->isbn())) << std::endl;
}
}
}

0 comments on commit 5fc880c

Please sign in to comment.