The following code would not compile, since it complains about trying to
copy cout. Any comments?
Robert
#include <string>
#include <map>
#include <vector>
#include <iterator>
#include "boost/lambda/lambda.hpp"
#include "boost/lambda/bind.hpp"
#include "boost/lambda/algorithm.hpp"
using namespace boost::lambda;
using namespace std;
int main() {
string s;
typedef map counters_t;
typedef counters_t::value_type counters_value_t;
counters_t counters;
typedef map occurences_t;
typedef occurences_t::value_type occurences_value_t;
occurences_t number_of_occurences;
while(cin >> s)
++counters[s];
for(map::const_iterator it = counters.begin();
it != counters.end(); ++it)
number_of_occurences[it->second].push_back(it->first);
std::for_each(number_of_occurences.begin(),
number_of_occurences.end(),
(cout << bind(&occurences_value_t::first, _1) << ":\t",
bind(ll::for_each(),
bind(call_begin(), bind(&occurences_value_t::second,
_1)),
bind(call_end(), bind(&occurences_value_t::second,
_1)),
protect(cout << _1 << " ")),
cout << "\n"));
return 0;
}
[Non-text portions of this message have been removed]