nit: const std::map& (avoiding unneded  copying)