#include <map>
#include <vector>
#include <algorithm>
#include <iostream>

int main()
{
    std::map<int, int> m = {{1, 10}, {2, 5}, {4, 6}, {6, 1}};
    using mypair = std::pair<int, int>;

    std::vector<mypair> v(begin(m), end(m));

    std::sort(std::begin(v), std::end(v), [](const mypair& a, const mypair& b) { return a.second < b.second; });

    for(auto const &p : v)
        std::cout << "m[" << p.first << "] = " << p.second << std::endl;

    return 0;
}