struct identity { typedef int result_type; result_type operator()( int i ) const { return i; } };
I'm guessing the result of your transform will be classified very "badly", i.e., as a SinglePassRange or something like that. Your reference type isn't a "real" reference, so the iterator_category of the iterators of your transformed range will be Input (I think) rather than Random Access :( This is required by the standard, is a defect (IMHO), and has been discussed at length on this list in the past.
I think Boost.Range should know to use boost's iterator traversal concepts rather than the standard library's iterator concepts in cases like this. John, please file a Trac ticket so we don't lose track of this issue. I will look into it when I get a chance. Thanks, Nate