|
Boost : |
From: Howard Hinnant (hinnant_at_[hidden])
Date: 2004-03-06 17:59:39
On Feb 26, 2004, at 2:34 PM, Peter Dimov wrote:
> but quality
> implementations of the TR1 proposal (Hi Howard!) are actually supposed
> to
> handle this code both as written (typos aside),
Hi! :-)
On Mar 1, 2004, at 1:00 AM, John Torjo wrote:
> on vc7.1:
> d:\boost\boost_latest\boost\boost\bind.hpp(273) : error C2664: 'void
> (int &,int)' : cannot convert parameter 1
...
> I'm not sure how this could be handled correctly (in any
> implementation).
Sure, it can be done.
On a Metrowerks version which has not been announced (much less
released):
#include <string>
#include <vector>
#include <algorithm>
#include <bind>
using namespace std::tr1;
using namespace std::tr1::placeholders;
struct test {
int i;
std::string s;
};
std::vector<test> tests;
void set(int & i, int val) { i = val; }
int main(int argc, char* argv[]) {
std::for_each( tests.begin(), tests.end(), bind(&set,
bind(mem_fn(&test::i),_1), 10) );
return 0;
}
// compiles and runs fine
-Howard
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk