Hi
Consider this case of boost::mem_fn applied to data members and in
association with boost::iterator_adaptors.

#include <boost/iterator_adaptors.hpp>
#include <boost/mem_fn.hpp>

struct foo {
    int m_data;
    // ..
};

std::vector<foo> data;
...
boost::make_projection_iterator(data.begin(), boost::mem_fn(&foo::m_data))

The line above "should" IMHO work, but with the current impl (VC7, latest
CVS) it ends up as a reference-to-reference problem. I believe this is a
very important and common(?) use-case.

What's the rationale for mem_fn to (in the case of data members) make it's
return_type a reference? Should mem_fn change to use a "plain" typedef (like
std::unary_function) or could iterator_adaptor perhaps mangle the input type
to avoid the reference-to-reference problem?
(I haven't tested with the sandbox iterator_adaptor v2 though)

Regards
/Fredrik Blomqvist




_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to