for( string& s : foos.get<1>() | boost::adaptors::transformed( m.get<1>().key_extractor() ) )
...
Visual Studio 2012 generates an ugly warning " warning C4172: returning address of local variable or temporary", and compiles. It also compiles on clang and gcc (sorry for not being too specific with versions, modern ones). But this is suspicious enough so I poked around a little bit. Sure enough, the key_from_value (the return type of key_extractor()) is a functor which is like
template< .. class Value .. >
struct key_from_value {
typedef Value result_type; // not Value&
Value& operator()( Foo&.. ) const { .. }
};
So isn't result_type being a non-reference type a problem here, given operator() is returning &?