
6 May
2004
6 May
'04
12:42 p.m.
John Torjo wrote:
#include <boost/bind.hpp> using namespace boost; #include <vector>
struct base { int i; };
struct test : public base { // if you uncomment here and comment above, it'll work // int i; };
int main() { typedef std::vector<test> vector; vector v; // generates compile-time error on vc7.1 bind<int&>( mem_fn(&test::i), _1) (v.front()); return 0; }
Yes, this is an unfortunate side effect of the current mem_fn implementation that relies on overloading tricks instead of enable_if + is_base_of for portability reasons.
Peter, any workarounds, until its' fixed?
Please use int test::* pm = &test::i; bind<int&>( mem_fn(pm), _1) (v.front()); if possible.