    #include <map>
    #include <string>
    #include <algorithm>
    #include <iterator>
    #include <iostream>
    
    // define the Sorter template class.  If sortdir == true, then we sort ascending
    template <bool sortdir = true>
    struct Sorter
    {
        bool operator()(const std::string& left, const std::string& right)
        {
            if ( sortdir )
                return left < right;
            return left > right;
        }
    };
    
    // our test maps
    typedef std::pair<unsigned long long, unsigned long long> mapDataType;

    // ascending map
    std::map<std::string, mapDataType, Sorter<>> myMap = {{"abc", {0,0}}, {"def",{0,1}}};  
    
    // descending map
    std::map<std::string, mapDataType, Sorter<false>> myMap2; // descending map

    // sample program    
    using namespace std;
    int main() 
    {
        // copy to descending map 
        std::copy(myMap.begin(), myMap.end(), std::inserter(myMap2, myMap2.begin()));

        cout << "The keys in ascending map are:\n";
        for (auto it : myMap)
        	cout << it.first << "\n";
        cout << "\nThe keys in descending map are:\n";
        for (auto it : myMap2)
        	cout << it.first << "\n";
        	
    }
