chun ping wang skrev:
Say lets say i have container of regular type T.
And lets say i want to insert them into ptr_vector by getting the keys.
template< typename MapType, typename OutputIterator > OutputIterator getKeys(const MapType& map, OutputIterator out ) { typedef typename MapType::value_type map_type; typedef typename OutputIterator::value_type out_type; std::for_each(map.begin(), map.end(), boost::lambda::var(*out)++ =
boost::lambda::construct
(boost::lambda::bind(&map_type::first, boost::lambda::_1)) ); return out; } Is it possble to do this. Assuming outputiterator is implemented for ptr_vector.
I guess you post the code because it does not work? Isn't it simpler just to write typedef typename MApType::const_iterator i = m.begin(), e = m.end(); for( ; i 1= e; ++i ) *out++ = i->first; ? -Thorsten