Boost logo

Boost :

From: Fredrik Blomqvist (fredrik_blomqvist_at_[hidden])
Date: 2004-09-16 11:53:32


Consider this example of mem_fn usage:

struct X { int bar; };
std::vector<X> vec;
boost::make_transform_iterator(vec.begin(), boost::mem_fn(&X::bar));

The above is, strictly speaking, _not_ a Random Access Traversal Iterator,
or even a Forward Traversal Iterator, and would fail in otherwise concept
conforming code (or in a potential concept-check).

The problems lies in the function objects returned by boost::mem_fn and
boost::bind not being default constructible, thus making the resulting
iterator not default constructible which is required by the Forward
Traversal concept.
(The problem is even more pronounced if using the "old" Iterator Concepts.)

I found an old (2002) mail by David Abrahams where he also noted the
But it didn't seem to have resulted in any change of the codebase.

I think use-cases similar to the one above are good motivation and hope this
could be considered an acceptable improvement.

// Fredrik Blomqvist

P.S. I realize it is very close to the branch for release and don't expect
this to be added before that.

Boost list run by bdawes at, gregod at, cpdaniel at, john at