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

const std::vector<std::string> ordering {"dog", "cat", "mouse", "elephant"};

struct cmp
{
   bool operator()(const std::string& lhs, const std::string& rhs)
   {
      return (std::find(ordering.begin(), ordering.end(), lhs) <
              std::find(ordering.begin(), ordering.end(), rhs));
   }
};

using MyMap = std::map<std::string, int, cmp>;

int main()
{
   MyMap a;
   a["elephant"] = 10;
   a["mouse"]= 20;
   for ( auto& item : a )
   {
      std::cout << item.first << " " << item.second << std::endl;
   }
}
