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<out_type>(boost::lambda::bind(&map_type::first, boost::lambda::_1))
       );
       return out;
}

Is it possble to do this. Assuming outputiterator is implemented for ptr_vector.