Checking if the entries of a map exist in another map
I believe you will find the standard library has the appropriate functions:
Includes

Includes tests whether one sorted range includes another sorted range. That is, it returns true if and only if, for every element in [first2, last2), an equivalent element [1] is also present in [first1, last1) [2]. Both [first1, last1) and [first2, last2) must be sorted in ascending order.
The two versions of includes differ in how they define whether one element is less than another. The first version compares objects using operator&lt;, and the second compares objects using the function object comp.

You can see all the algorithms here
Your code would look like this:
#include &lt;algorithm&gt;
#include &lt;iostream&gt;
#include &lt;map&gt;

int main()
{
    std::map&lt;int, std::string&gt; a;
    std::map&lt;int, std::string&gt; b;

    a[0] = &quot;0&quot;;
    a[1] = &quot;1&quot;;

    b[0] = &quot;0&quot;;

    std::cout &lt;&lt; &quot;b ⊆ a? &quot; &lt;&lt; std::includes(a.begin(), a.end(), b.begin(), b.end()) &lt;&lt; &quot; (should be 1)\n&quot;;

    b[1] = &quot;1&quot;;
    std::cout &lt;&lt; &quot;b ⊆ a? &quot; &lt;&lt; std::includes(a.begin(), a.end(), b.begin(), b.end()) &lt;&lt; &quot; (should be 1)\n&quot;;

    b[2] = &quot;2&quot;;
    std::cout &lt;&lt; &quot;b ⊆ a? &quot; &lt;&lt; std::includes(a.begin(), a.end(), b.begin(), b.end()) &lt;&lt; &quot; (should be 0)\n&quot;;
}